/** * 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(); }
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); }
/** * Determine whether this object is equal to another. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(final Object other) { return other instanceof StatefulEJBLocator && equals((StatefulEJBLocator<?>) other); }
public StatefulEJBLocator<T> withNewAffinity(final Affinity affinity) { Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) ? this : new StatefulEJBLocator<T>(this, affinity); }
/** * Construct a new instance. * * @param viewType the view type (must not be {@code null}) * @param identifier the EJB identifier (must not be {@code null}) * @param sessionId the stateful session ID (must not be {@code null}) * @param affinity the {@link Affinity} for this stateful bean locator * @param <T> the remote view type * @return the new instance (not {@code null}) */ public static <T> StatefulEJBLocator<T> create(final Class<T> viewType, final EJBIdentifier identifier, final SessionID sessionId, final Affinity affinity) { return new StatefulEJBLocator<T>(viewType, identifier, sessionId, affinity); }
@SuppressWarnings("unchecked") public <S> StatefulEJBLocator<? extends S> narrowAsStateful(final Class<S> type) { if (type.isAssignableFrom(getViewType())) { return (StatefulEJBLocator<? extends S>) this; } throw new ClassCastException(type.toString()); }
/** * Get a copy of this stateful EJB locator, but without any session ID. * * @return the stateless EJB locator (not {@code null}) */ public StatelessEJBLocator<T> withoutSession() { return new StatelessEJBLocator<T>(this, getAffinity()); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) throws Exception { SessionID sessionID = (SessionID) contextData.get(SessionID.class); final StatefulEJBLocator<?> statefulEJBLocator; final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent(); if (sessionID == null) { statefulEJBLocator = EJBClient.createSession(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL)); } else { statefulEJBLocator = StatefulEJBLocator.create(componentView.getViewClass(), identifier, sessionID, statefulSessionComponent.getCache().getStrictAffinity()); } final Object ejbProxy = EJBClient.createProxy(statefulEJBLocator); return new ValueManagedReference(new ImmediateValue<Object>(ejbProxy)); }
Object readResolve() { return new StatefulEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, sessionId, affinity); } }
public StatefulEJBLocator<T> withNewAffinity(final Affinity affinity) { Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) ? this : new StatefulEJBLocator<T>(this, affinity); }
@SuppressWarnings("unchecked") public <S> StatefulEJBLocator<? extends S> narrowAsStateful(final Class<S> type) { if (type.isAssignableFrom(getViewType())) { return (StatefulEJBLocator<? extends S>) this; } throw new ClassCastException(type.toString()); }
/** * Get a copy of this stateful EJB locator, but without any session ID. * * @return the stateless EJB locator (not {@code null}) */ public StatelessEJBLocator<T> withoutSession() { return new StatelessEJBLocator<T>(this, getAffinity()); }
@Override public String toString() { return String.format("%s, session ID is %s", super.toString(), getSessionId()); } }
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> withSession(final SessionID sessionId) { Assert.checkNotNullParam("sessionId", sessionId); return new StatefulEJBLocator<T>(this, sessionId); }
public StatefulEJBLocator<T> withNewAffinity(final Affinity affinity) { Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) ? this : new StatefulEJBLocator<T>(this, affinity); }
/** * Determine whether this object is equal to another. * * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(final EJBLocator<?> other) { return other instanceof StatefulEJBLocator && equals((StatefulEJBLocator<?>) other); }
@SuppressWarnings("unchecked") public <S> StatefulEJBLocator<? extends S> narrowAsStateful(final Class<S> type) { if (type.isAssignableFrom(getViewType())) { return (StatefulEJBLocator<? extends S>) this; } throw new ClassCastException(type.toString()); }
/** * Get a copy of this stateful EJB locator, but without any session ID. * * @return the stateless EJB locator (not {@code null}) */ public StatelessEJBLocator<T> withoutSession() { return new StatelessEJBLocator<T>(this, getAffinity()); }
private static Affinity getWeakAffinity(final StatefulSessionComponent statefulSessionComponent, final StatefulEJBLocator<?> statefulEJBLocator) { final SessionID sessionID = statefulEJBLocator.getSessionId(); return getWeakAffinity(statefulSessionComponent, sessionID); }