/** * Construct a new instance. This method uses the location from the original locator, but with the given * session ID and affinity. * * @param original the original locator (must not be {@code null}) * @param newAffinity the new affinity * @param <T> the remote view type * @return the new instance (not {@code null}) */ public static <T> StatelessEJBLocator<T> create(final EJBLocator<T> original, final Affinity newAffinity) { return new StatelessEJBLocator<T>(original, newAffinity); }
/** * 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 StatelessEJBLocator && equals((StatelessEJBLocator<?>) other); }
public StatelessEJBLocator<T> withNewAffinity(final Affinity affinity) { Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) ? this : new StatelessEJBLocator<T>(this, affinity); }
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(); }
affinity = statelessLocator.getAffinity(); final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); StatefulEJBLocator<T> locator = statelessLocator.withSessionAndAffinity(SessionID.createSessionID(bytes), affinity); clientInvocationContext.setLocator(locator); return locator;
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) { Object value = EJBClient.createProxy(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL)); return new ValueManagedReference(new ImmediateValue<>(value)); }
@SuppressWarnings("unchecked") public <S> StatelessEJBLocator<? extends S> narrowAsStateless(final Class<S> type) { if (type.isAssignableFrom(getViewType())) { return (StatelessEJBLocator<? extends S>) this; } throw new ClassCastException(type.toString()); }
return statelessLocator.withSessionAndAffinity(sessionID, affinity);
affinity = statelessLocator.getAffinity(); final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); StatefulEJBLocator<T> locator = statelessLocator.withSessionAndAffinity(SessionID.createSessionID(bytes), affinity); clientInvocationContext.setLocator(locator); return locator;
} else if (stateful) { try { ejbLocator = EJBClient.createSession(StatelessEJBLocator.create(viewClass, identifier, appclient ? Affinity.NONE : Affinity.LOCAL)); } catch (Exception e) { throw EjbLogger.ROOT_LOGGER.failedToCreateSessionForStatefulBean(e, identifier.toString()); ejbLocator = StatelessEJBLocator.create(viewClass, identifier, appclient ? Affinity.NONE : Affinity.LOCAL);
<T> EJBSessionCreationInvocationContext createSessionCreationInvocationContext(StatelessEJBLocator<T> statelessLocator, AuthenticationContext authenticationContext) { EJBClientContext.InterceptorList interceptorList = getInterceptors(statelessLocator.getViewType()); return new EJBSessionCreationInvocationContext(statelessLocator, this, authenticationContext, interceptorList); }
return statelessLocator.withSessionAndAffinity(sessionID, 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 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> StatelessEJBLocator<T> create(final Class<T> viewType, final EJBIdentifier identifier, final Affinity affinity) { return new StatelessEJBLocator<T>(viewType, identifier, affinity); }
public StatelessEJBLocator<T> withNewAffinity(final Affinity affinity) { Assert.checkNotNullParam("affinity", affinity); return getAffinity().equals(affinity) ? this : new StatelessEJBLocator<T>(this, affinity); }
affinity = statelessLocator.getAffinity(); final int cmd = response.readUnsignedByte(); final XAOutflowHandle outflowHandle = getOutflowHandle(); StatefulEJBLocator<T> locator = statelessLocator.withSessionAndAffinity(SessionID.createSessionID(bytes), affinity); clientInvocationContext.setLocator(locator); return locator;
@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)); }
/** * 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 StatelessEJBLocator && equals((StatelessEJBLocator<?>) other); }
@SuppressWarnings("unchecked") public <S> StatelessEJBLocator<? extends S> narrowAsStateless(final Class<S> type) { if (type.isAssignableFrom(getViewType())) { return (StatelessEJBLocator<? extends S>) this; } throw new ClassCastException(type.toString()); }
return statelessLocator.withSessionAndAffinity(sessionID, affinity);
Object readResolve() { return new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, distinctName, affinity); } }