@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";
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; } }
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) {
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; } }
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); } }
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()); } }
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()); } }
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()); } }
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; } }
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; } }
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; } }
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; }
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; }
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; }