java.rmi.RemoteException.getStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(13.0k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中java.rmi.RemoteException.getStackTrace方法的一些代码示例,展示了RemoteException.getStackTrace的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteException.getStackTrace方法的具体详情如下:
包路径:java.rmi.RemoteException
类名称:RemoteException
方法名:getStackTrace

RemoteException.getStackTrace介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public final RemoteException transactionPropagationNotSupported() {
  final RemoteException result = new RemoteException(String.format(getLoggingLocale(), transactionPropagationNotSupported$str()));
  final StackTraceElement[] st = result.getStackTrace();
  result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
  return result;
}
private static final String cannotCallMethodInAfterCompletion = "WFLYEJB0388: Cannot call method %s in afterCompletion callback";

代码示例来源:origin: xap/xap

public void commit(Xid xid, boolean onePhase) throws XAException {
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE, "XAResourceImpl:commit(), the xid is:" + xid + ", the onePhase:" + onePhase + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId());
  }
  xid = createGSXid(xid);
  try {
    m_txnManger.commit(xid, COMMIT_ABORT_DEFAULT_TIMEOUT);
  } catch (UnknownTransactionException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:commit() , unknowntxnException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XAER_RMERR, e);
  } catch (CannotCommitException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:commit() , cannotcommitException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XAER_RMERR, e);
  } catch (RemoteException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:commit() , remoteException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XAER_RMFAIL, e);
  } catch (TimeoutExpiredException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:commit() , timeoutexpiredException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XAER_RMFAIL, e);
  } finally {
    _activeEmptyTransactions.remove(xid);
    _suspendedXtns.remove(xid);
    if (_resourcePerSingleTxn)
      _relevantTx = false;
  }
}

代码示例来源:origin: xap/xap

return XATransactionFactory.create(m_txnManger, xid, m_timeout * 1000L, setAsDefault, _proxy, this, _delegatedXa);
} catch (RemoteException e) {
  _logger.log(Level.SEVERE, "XAResourceImpl:startIn() , remoteException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
  throw createsXAException(XAException.XA_RBCOMMFAIL, e);
} catch (LeaseDeniedException e) {

代码示例来源:origin: xap/xap

public void rollback(Xid xid) throws XAException {
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE, "XAResourceImpl:rollback(), the Xid is:" + xid + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId());
  }
  xid = createGSXid(xid);
  try {
    m_txnManger.abort(xid, COMMIT_ABORT_DEFAULT_TIMEOUT);
  } catch (UnknownTransactionException e) {
    if (failOnInvalidRollback)
      _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , unknownTxnException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XA_RBPROTO, e);
  } catch (CannotAbortException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , CannotAbortException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XA_RBPROTO, e);
  } catch (RemoteException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , remoteException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XA_RBCOMMFAIL, e);
  } catch (TimeoutExpiredException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:rollback() , timeoutException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XAER_RMFAIL, e);
  } finally {
    _activeEmptyTransactions.remove(xid);
    _suspendedXtns.remove(xid);
    if (_resourcePerSingleTxn)
      _relevantTx = false;
  }
}

代码示例来源:origin: xap/xap

public int prepare(Xid xid) throws XAException {
  if (_logger.isLoggable(Level.FINE)) {
    _logger.log(Level.FINE, "XAResourceImpl:prepare(), the Xid is: " + xid + " rmid=" + _rmid + " thread=" + Thread.currentThread().getId());
  }
  xid = createGSXid(xid);
  if (_activeEmptyTransactions.remove(xid) != null) { // if empty than read_only
    return XA_RDONLY;
  }
  try {
    int result = m_txnManger.prepare(xid);
    switch (result) { // Try to prepare
      case TransactionParticipant.PREPARED:
        return XA_OK;
      case TransactionParticipant.NOTCHANGED:
        return XA_RDONLY;
      default: // Abort
        throw new XAException(XAException.XA_RBROLLBACK);
    }
  } catch (UnknownTransactionException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , UnknownTransactionException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XA_RBROLLBACK, e);
  } catch (CannotCommitException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , CannotCommitException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XA_RBROLLBACK, e);
  } catch (RemoteException e) {
    _logger.log(Level.SEVERE, "XAResourceImpl:prepare() , remoteException  rmid=" + _rmid + " thread=" + Thread.currentThread().getId() + " exception:" + e + e.getStackTrace());
    throw createsXAException(XAException.XA_RBCOMMFAIL, e);
  }
}

代码示例来源:origin: com.jns.apps/scallop-host-rmi

public void unregisterService(String uri) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  try {
    Registry registry = rmiRegistries.get(Integer.toString(rmiURI.port));
    if (registry == null) {
      registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory);
      rmiRegistries.put(Integer.toString(rmiURI.port), registry);
    }
    registry.unbind(rmiURI.serviceName);
    logger.info("RMI service unregistered: " + rmiURI);
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  } catch (NotBoundException e) {
    throw new RMIHostException(e.getMessage());
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-host-rmi

public void unregisterService(String uri) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  try {
    Registry registry = rmiRegistries.get(Integer.toString(rmiURI.port));
    if (registry == null) {
      registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory);
      rmiRegistries.put(Integer.toString(rmiURI.port), registry);
    }
    registry.unbind(rmiURI.serviceName);
    logger.info("RMI service unregistered: " + rmiURI);
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  } catch (NotBoundException e) {
    throw new RMIHostException(e.getMessage());
  }
}

代码示例来源:origin: org.apache.tuscany.sca.aggregation/tuscany-binding-rmi-runtime-aggregation

public void unregisterService(String uri) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  try {
    Registry registry = rmiRegistries.get(Integer.toString(rmiURI.port));
    if (registry == null) {
      registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory);
      rmiRegistries.put(Integer.toString(rmiURI.port), registry);
    }
    registry.unbind(rmiURI.serviceName);
    logger.info("RMI service unregistered: " + rmiURI);
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  } catch (NotBoundException e) {
    throw new RMIHostException(e.getMessage());
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-host-rmi

public String registerService(String uri, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  Registry registry;
  try {
    registry = rmiRegistries.get(Integer.toString(rmiURI.port));
    if (registry == null) {
      try {
        registry = LocateRegistry.createRegistry(rmiURI.port, socketFactory, socketFactory);
      } catch (RemoteException e) {
        registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory);
      } 
      rmiRegistries.put(Integer.toString(rmiURI.port), registry);
    }
    registry.bind(rmiURI.serviceName, serviceObject);
    logger.info("RMI service registered: " + rmiURI);
    return rmiURI.toString();
  } catch (AlreadyBoundException e) {
    throw new RMIHostException(e);
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  }
}

代码示例来源:origin: org.apache.tuscany.sca.aggregation/tuscany-binding-rmi-runtime-aggregation

public String registerService(String uri, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  Registry registry;
  try {
    registry = rmiRegistries.get(Integer.toString(rmiURI.port));
    if (registry == null) {
      try {
        registry = LocateRegistry.createRegistry(rmiURI.port, socketFactory, socketFactory);
      } catch (RemoteException e) {
        registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory);
      } 
      rmiRegistries.put(Integer.toString(rmiURI.port), registry);
    }
    registry.bind(rmiURI.serviceName, serviceObject);
    logger.info("RMI service registered: " + rmiURI);
    return rmiURI.toString();
  } catch (AlreadyBoundException e) {
    throw new RMIHostException(e);
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  }
}

代码示例来源:origin: com.jns.apps/scallop-host-rmi

public String registerService(String uri, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  Registry registry;
  try {
    registry = rmiRegistries.get(Integer.toString(rmiURI.port));
    if (registry == null) {
      try {
        RMISocketFactory serverSocketFactory = new RMISocketFactoryImpl(rmiURI.host, CONNECTION_TIMEOUT);
        logger.info("--------------------------------------------------registerService uri = "+uri+"----------------------------------");
        registry = LocateRegistry.createRegistry(rmiURI.port, socketFactory, serverSocketFactory);
      } catch (RemoteException e) {
        registry = LocateRegistry.getRegistry(null, rmiURI.port, socketFactory);
      } 
      rmiRegistries.put(Integer.toString(rmiURI.port), registry);
    }
    registry.bind(rmiURI.serviceName, serviceObject);
    logger.info("RMI service registered: " + rmiURI);
    return rmiURI.toString();
  } catch (AlreadyBoundException e) {
    throw new RMIHostException(e);
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  }
}

代码示例来源:origin: com.jns.apps/scallop-host-rmi

public Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  Remote remoteService = null;
  try {
    // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve"
    // in security policy.
    Registry registry = rmiRemoteRegistries.get(uri);
    if(registry == null){
      registry = LocateRegistry.getRegistry(rmiURI.host, rmiURI.port, socketFactory);
      rmiRemoteRegistries.put(uri, registry);
    }
    if (registry != null) {
      remoteService = registry.lookup(rmiURI.serviceName);
    }
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  } catch (NotBoundException e) {
    throw new RMIHostException(e.getMessage());
  }
  return remoteService;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-host-rmi

public Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  Remote remoteService = null;
  try {
    // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve"
    // in security policy.
    Registry registry = LocateRegistry.getRegistry(rmiURI.host, rmiURI.port, socketFactory);
    if (registry != null) {
      remoteService = registry.lookup(rmiURI.serviceName);
    }
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  } catch (NotBoundException e) {
    throw new RMIHostException(e.getMessage());
  }
  return remoteService;
}

代码示例来源:origin: org.apache.tuscany.sca.aggregation/tuscany-binding-rmi-runtime-aggregation

public Remote findService(String uri) throws RMIHostException, RMIHostRuntimeException {
  RMIURI rmiURI = new RMIURI(uri);
  Remote remoteService = null;
  try {
    // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve"
    // in security policy.
    Registry registry = LocateRegistry.getRegistry(rmiURI.host, rmiURI.port, socketFactory);
    if (registry != null) {
      remoteService = registry.lookup(rmiURI.serviceName);
    }
  } catch (RemoteException e) {
    RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
    rmiExec.setStackTrace(e.getStackTrace());
    throw rmiExec;
  } catch (NotBoundException e) {
    throw new RMIHostException(e.getMessage());
  }
  return remoteService;
}

相关文章