protected Connection convert(final ConnectionPeerIdentity arg) throws IOException { return arg.getConnection(); } }
public void end(final int flags) throws XAException { if (flags == XAResource.TMFAIL && rollbackOnlyXids.add(xid)) try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).setRollbackOnly(xid, peerIdentity); } catch (Throwable t) { rollbackOnlyXids.remove(xid); throw t; } }
public void rollback() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).rollback(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
public int prepare() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); return getOperationsXA(peerIdentity.getConnection()).prepare(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
public void forget() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).forget(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
public void commit(final boolean onePhase) throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).commit(xid, onePhase, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } } };
public void beforeCompletion() throws XAException { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).beforeCompletion(xid, peerIdentity); }
@NotNull public Xid[] recover(final int flag, final String parentName) throws XAException { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); return getOperationsXA(peerIdentity.getConnection()).recover(flag, parentName, peerIdentity); }
RemoteClientTransport getRemoteTransport(ConnectionPeerIdentity peerIdentity) throws NamingException { final Endpoint endpoint = provider.getEndpoint(); if (endpoint == null) { throw Messages.log.noRemotingEndpoint(); } try { final Connection connection = peerIdentity.getConnection(); final IoFuture<RemoteClientTransport> future = RemoteClientTransport.SERVICE_HANDLE.getClientService(connection, OptionMap.EMPTY); try { return future.getInterruptibly(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); future.cancel(); throw Messages.log.operationInterrupted(); } } catch (IOException e) { if (e.getCause() instanceof NamingException) { throw (NamingException) e.getCause(); } throw Messages.log.connectFailed(e); } }
@NotNull public SimpleTransactionControl begin(final int timeout) throws SystemException { // this one is bound to the connection try { final ConnectionPeerIdentity peerIdentity = getPeerIdentity(); return getOperations(peerIdentity.getConnection()).begin(peerIdentity); } catch (IOException e) { throw Log.log.failedToAcquireConnection(e); } } }
protected boolean isConnected(final URI uri) { final IoFuture<ConnectionPeerIdentity> future = Endpoint.getCurrent().getConnectedIdentityIfExists(uri, "ejb", "jboss", AuthenticationContext.captureCurrent()); try { return future != null && future.getStatus() == IoFuture.Status.DONE && future.get().getConnection().isOpen(); } catch (IOException e) { // impossible throw Assert.unreachableCode(); } }
protected SessionID createSession(final EJBReceiverSessionCreationContext context) throws Exception { final StatelessEJBLocator<?> statelessLocator = context.getClientInvocationContext().getLocator().asStateless(); final AuthenticationContext authenticationContext = context.getAuthenticationContext(); try { IoFuture<ConnectionPeerIdentity> futureConnection = getConnection(context.getClientInvocationContext(), context.getClientInvocationContext().getDestination(), authenticationContext); final ConnectionPeerIdentity identity = futureConnection.getInterruptibly(); final EJBClientChannel ejbClientChannel = getClientChannel(identity.getConnection()); final StatefulEJBLocator<?> result = ejbClientChannel.openSession(statelessLocator, identity, context.getClientInvocationContext()); return result.getSessionId(); } catch (IOException e) { final RequestSendFailedException failed = new RequestSendFailedException("Failed to create stateful EJB: " + e.getMessage(), true); failed.initCause(e); throw failed; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CreateException("Stateful EJB creation interrupted"); } }
receiverContext.requestFailed(new RequestSendFailedException(e.getMessage() + " @ " + peerIdentity.getConnection().getPeerURI(), e, true), getRetryExecutor()); } catch (RollbackException | SystemException | RuntimeException e) { receiverContext.requestFailed(new EJBException(e.getMessage(), e), getRetryExecutor());
public void end(final int flags) throws XAException { if (flags == XAResource.TMFAIL && rollbackOnlyXids.add(xid)) try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).setRollbackOnly(xid, peerIdentity); } catch (Throwable t) { rollbackOnlyXids.remove(xid); throw t; } }
public void forget() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).forget(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
public void rollback() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).rollback(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
public void forget() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).forget(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
public void commit(final boolean onePhase) throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); getOperationsXA(peerIdentity.getConnection()).commit(xid, onePhase, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } } };
public int prepare() throws XAException { try { final ConnectionPeerIdentity peerIdentity = getPeerIdentityXA(); return getOperationsXA(peerIdentity.getConnection()).prepare(xid, peerIdentity); } finally { rollbackOnlyXids.remove(xid); } }
@NotNull public SimpleTransactionControl begin(final int timeout) throws SystemException { // this one is bound to the connection try { final ConnectionPeerIdentity peerIdentity = getPeerIdentity(); return getOperations(peerIdentity.getConnection()).begin(peerIdentity); } catch (IOException e) { throw Log.log.failedToAcquireConnection(e); } } }