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"); } }
protected SessionID createSession(final EJBReceiverSessionCreationContext receiverContext) throws Exception { final StatelessEJBLocator<?> statelessLocator = receiverContext.getClientInvocationContext().getLocator().asStateless(); final EjbDeploymentInformation ejbInfo = findBean(statelessLocator); final EJBComponent component = ejbInfo.getEjbComponent(); if (!(component instanceof StatefulSessionComponent)) { throw EjbLogger.ROOT_LOGGER.notStatefulSessionBean(statelessLocator.getAppName(), statelessLocator.getModuleName(), statelessLocator.getDistinctName(), statelessLocator.getBeanName()); } component.waitForComponentStart(); return ((StatefulSessionComponent) component).createSession(); }
/** * Proceed with the next interceptor in the chain, calling the resolved receiver in the end. * * @return the session ID (not {@code null}) * @throws Exception if the EJB session creation failed for some reason */ public SessionID proceed() throws Exception { final int idx = interceptorChainIndex++; try { final EJBClientInterceptorInformation[] chain = interceptorList.getInformation(); if (idx > chain.length) { throw Assert.unreachableCode(); } if (chain.length == idx) { final URI destination = getDestination(); final EJBReceiver receiver = getClientContext().resolveReceiver(destination, getLocator()); setReceiver(receiver); final SessionID sessionID = receiver.createSession(new EJBReceiverSessionCreationContext(this, authenticationContext)); if (sessionID == null) { throw Logs.INVOCATION.nullSessionID(receiver, getLocator().asStateless()); } retry = false; return sessionID; } else { return chain[idx].getInterceptorInstance().handleSessionCreation(this); } } finally { interceptorChainIndex --; } }
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"); } }
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"); } }
/** * Proceed with the next interceptor in the chain, calling the resolved receiver in the end. * * @return the session ID (not {@code null}) * @throws Exception if the EJB session creation failed for some reason */ public SessionID proceed() throws Exception { final int idx = interceptorChainIndex++; try { final EJBClientInterceptorInformation[] chain = interceptorList.getInformation(); if (idx > chain.length) { throw Assert.unreachableCode(); } if (chain.length == idx) { final URI destination = getDestination(); final EJBReceiver receiver = getClientContext().resolveReceiver(destination, getLocator()); setReceiver(receiver); final SessionID sessionID = receiver.createSession(new EJBReceiverSessionCreationContext(this, authenticationContext)); if (sessionID == null) { throw Logs.INVOCATION.nullSessionID(receiver, getLocator().asStateless()); } retry = false; return sessionID; } else { return chain[idx].getInterceptorInstance().handleSessionCreation(this); } } finally { interceptorChainIndex --; } }
/** * Proceed with the next interceptor in the chain, calling the resolved receiver in the end. * * @return the session ID (not {@code null}) * @throws Exception if the EJB session creation failed for some reason */ public SessionID proceed() throws Exception { final int idx = interceptorChainIndex++; try { final EJBClientInterceptorInformation[] chain = interceptorList.getInformation(); if (idx > chain.length) { throw Assert.unreachableCode(); } if (chain.length == idx) { final URI destination = getDestination(); final EJBReceiver receiver = getClientContext().resolveReceiver(destination, getLocator()); setReceiver(receiver); final SessionID sessionID = receiver.createSession(new EJBReceiverSessionCreationContext(this, authenticationContext)); if (sessionID == null) { throw Logs.INVOCATION.nullSessionID(receiver, getLocator().asStateless()); } retry = false; return sessionID; } else { return chain[idx].getInterceptorInstance().handleSessionCreation(this); } } finally { interceptorChainIndex --; } }