/** * Creates a session for a stateful session bean represented by the passed app name, module name, distinct name * and bean name combination. Returns a {@link StatefulEJBLocator} representing the newly created session. The * returned locator should have the same view type as the requested locator. * * @param receiverContext the EJB receiver session creation context * @return the session ID for the newly opened session * @throws IllegalArgumentException if the session creation request is made for a bean which is <i>not</i> a * stateful session bean */ protected SessionID createSession(final EJBReceiverSessionCreationContext receiverContext) throws Exception { return createSession$$bridge(receiverContext).getSessionId(); }
@Override public String toString() { return String.format("%s, session ID is %s", super.toString(), getSessionId()); } }
private static Affinity getWeakAffinity(final StatefulSessionComponent statefulSessionComponent, final StatefulEJBLocator<?> statefulEJBLocator) { final SessionID sessionID = statefulEJBLocator.getSessionId(); return getWeakAffinity(statefulSessionComponent, sessionID); }
void setSessionID(final SessionID sessionID) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.isStateful()) { if (oldVal.asStateful().getSessionId().equals(sessionID)) { // harmless/idempotent return; } throw Logs.MAIN.ejbIsAlreadyStateful(); } newVal = oldVal.withSession(sessionID); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
public StatefulEJBLocator<T> withSessionAndAffinity(final SessionID sessionId, final Affinity affinity) { Assert.checkNotNullParam("sessionId", sessionId); Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) && getSessionId().equals(sessionId) ? this : new StatefulEJBLocator<T>(this, sessionId, affinity); }
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"); } }
interceptorContext.putPrivateData(SessionID.class, ejbLocator.asStateful().getSessionId());
final ByteArrayOutputStream stream = new ByteArrayOutputStream(); marshaller.start(new OutputStreamByteOutput(stream)); marshaller.writeObject(((StatefulEJBLocator<?>) locator).getSessionId()); marshaller.finish(); return beanReferenceFactory.createReferenceWithId(stream.toByteArray(), beanRepositoryIds[0]);
interceptorContext.putPrivateData(SessionID.class, locator.asStateful().getSessionId()); } else if (locator instanceof EntityEJBLocator) { throw EjbLogger.ROOT_LOGGER.ejbNotFoundInDeployment(locator);
.setBeanName(locator.getBeanName()); if (locator instanceof StatefulEJBLocator) { builder.setBeanId(Base64.getUrlEncoder().encodeToString(locator.asStateful().getSessionId().getEncodedForm()));
/** * Creates a session for a stateful session bean represented by the passed app name, module name, distinct name * and bean name combination. Returns a {@link StatefulEJBLocator} representing the newly created session. The * returned locator should have the same view type as the requested locator. * * @param receiverContext the EJB receiver session creation context * @return the session ID for the newly opened session * @throws IllegalArgumentException if the session creation request is made for a bean which is <i>not</i> a * stateful session bean */ protected SessionID createSession(final EJBReceiverSessionCreationContext receiverContext) throws Exception { return createSession$$bridge(receiverContext).getSessionId(); }
/** * Creates a session for a stateful session bean represented by the passed app name, module name, distinct name * and bean name combination. Returns a {@link StatefulEJBLocator} representing the newly created session. The * returned locator should have the same view type as the requested locator. * * @param receiverContext the EJB receiver session creation context * @return the session ID for the newly opened session * @throws IllegalArgumentException if the session creation request is made for a bean which is <i>not</i> a * stateful session bean */ protected SessionID createSession(final EJBReceiverSessionCreationContext receiverContext) throws Exception { return createSession$$bridge(receiverContext).getSessionId(); }
@Override public String toString() { return String.format("%s, session ID is %s", super.toString(), getSessionId()); } }
@Override public String toString() { return String.format("%s, session ID is %s", super.toString(), getSessionId()); } }
private Affinity getWeakAffinity(final StatefulSessionComponent statefulSessionComponent, final StatefulEJBLocator<?> statefulEJBLocator) { final SessionID sessionID = statefulEJBLocator.getSessionId(); return statefulSessionComponent.getCache().getWeakAffinity(sessionID); }
void setSessionID(final SessionID sessionID) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.isStateful()) { if (oldVal.asStateful().getSessionId().equals(sessionID)) { // harmless/idempotent return; } throw Logs.MAIN.ejbIsAlreadyStateful(); } newVal = oldVal.withSession(sessionID); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
void setSessionID(final SessionID sessionID) { final AtomicReference<EJBLocator<T>> locatorRef = this.locatorRef; EJBLocator<T> oldVal, newVal; do { oldVal = locatorRef.get(); if (oldVal.isStateful()) { if (oldVal.asStateful().getSessionId().equals(sessionID)) { // harmless/idempotent return; } throw Logs.MAIN.ejbIsAlreadyStateful(); } newVal = oldVal.withSession(sessionID); } while (! locatorRef.compareAndSet(oldVal, newVal)); }
public StatefulEJBLocator<T> withSessionAndAffinity(final SessionID sessionId, final Affinity affinity) { Assert.checkNotNullParam("sessionId", sessionId); Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) && getSessionId().equals(sessionId) ? this : new StatefulEJBLocator<T>(this, sessionId, affinity); }
public StatefulEJBLocator<T> withSessionAndAffinity(final SessionID sessionId, final Affinity affinity) { Assert.checkNotNullParam("sessionId", sessionId); Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) && getSessionId().equals(sessionId) ? this : new StatefulEJBLocator<T>(this, sessionId, affinity); }
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"); } }