@Override public <T> void setLocator(EJBLocator<T> locator) { super.setLocator(locator); Affinity affinity = locator.getAffinity(); if (affinity instanceof ClusterAffinity) { ClusterAffinityInterest interest = invocationHandler.getAttachment(ClusterAffinityInterest.KEY); if (interest != null) { interest.notifyAssignment((ClusterAffinity)affinity); } } }
/** * Get the proxy class for this locator. * * @return the proxy class */ public Class<? extends T> getProxyClass() { return getProxyInformation().getProxyClass(); }
<T> EJBSessionCreationInvocationContext createSessionCreationInvocationContext(StatelessEJBLocator<T> statelessLocator, AuthenticationContext authenticationContext) { EJBClientContext.InterceptorList interceptorList = getInterceptors(statelessLocator.getViewType()); return new EJBSessionCreationInvocationContext(statelessLocator, this, authenticationContext, interceptorList); }
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 AbstractEJBMetaData<?, ?> toAbstractEJBMetaData() { final EJBHomeLocator<? extends EJBHome> homeLocator = EJBClient.getLocatorFor(home).narrowAsHome(homeClass); final Class<? extends EJBObject> ejbObjectClass = remoteClass.asSubclass(EJBObject.class); if (session || statelessSession) { if (statelessSession) { return StatelessEJBMetaData.create(ejbObjectClass, homeLocator); } return StatefulEJBMetaData.create(ejbObjectClass, homeLocator); } else { return EntityEJBMetaData.create(ejbObjectClass, homeLocator, pkClass); } }
static Application toApplication(EJBIdentifier id) { return new Application(id.getAppName(), id.getModuleName(), id.getDistinctName()); }
public Object handleInvocationResult(final EJBClientInvocationContext context) throws Exception { try { return context.getResult(); } catch (NoSuchEJBException | RequestSendFailedException e) { if (context.getAttachment(SKIP_MISSING_TARGET) != Boolean.TRUE) { processMissingTarget(context); } throw e; } finally { context.removeAttachment(SKIP_MISSING_TARGET); } }
private static <T extends EJBObject, H extends EJBHome> StatefulEJBMetaData<T, ? extends H> createStatefulMetaData(Class<T> remoteClass, Class<H> homeClass, EJBHome home) { return new StatefulEJBMetaData<>(remoteClass, EJBClient.getLocatorFor(home).<H>narrowAsHome(homeClass)); }
private static <T extends EJBObject, H extends EJBHome> StatelessEJBMetaData<T, ? extends H> createStatelessMetaData(Class<T> remoteClass, Class<H> homeClass, EJBHome home) { return new StatelessEJBMetaData<>(remoteClass, EJBClient.getLocatorFor(home).<H>narrowAsHome(homeClass)); }
private static <T extends EJBObject, H extends EJBHome> EntityEJBMetaData<T, ? extends H> createEntityMetaData(Class<T> remoteClass, Class<H> homeClass, EJBHome home, Class<?> pkClass) { return new EntityEJBMetaData<>(remoteClass, EJBClient.getLocatorFor(home).<H>narrowAsHome(homeClass), pkClass); }
/** * Create a new EJB session. * * @param viewType the view type class * @param appName the application name * @param moduleName the module name * @param beanName the EJB name * @param <T> the view type * @return the new EJB locator * @throws CreateException if an error occurs */ public static <T> StatefulEJBLocator<T> createSession(final Class<T> viewType, final String appName, final String moduleName, final String beanName) throws Exception { return createSession(new StatelessEJBLocator<T>(viewType, appName, moduleName, beanName, Affinity.NONE)); }
int calculateHashCode() { return sessionId.hashCode() * 13 + super.calculateHashCode(); }
/** * 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()); }
/** * 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(EJBLocator<?> other) { return this == other || other != null && hashCode == other.hashCode && identifier.equals(other.identifier) && affinity.equals(other.affinity); }
/** * Determine whether the method is definitely synchronous, that is, it is not marked client-async, and the return * value of the method is not {@code void} or {@code Future<?>}. * * @return {@code true} if the method is definitely synchronous, {@code false} if the method may be asynchronous */ public boolean isSynchronous() { return ! isClientAsync() && methodInfo.isSynchronous(); }
/** * Get the proxy class constructor for this locator. A proxy class constructor accepts a single * argument of type {@link InvocationHandler}. * * @return the proxy constructor */ public Constructor<? extends T> getProxyConstructor() { return getProxyInformation().getProxyConstructor(); }
/** * Determine whether the method is marked client-asynchronous, meaning that invocation should be asynchronous regardless * of whether the server-side method is asynchronous. * * @return {@code true} if the method is marked client-asynchronous, {@code false} otherwise */ public boolean isClientAsync() { return invocationHandler.isAsyncHandler() || methodInfo.isClientAsync(); }
InterceptorList getGlobalInterceptors() { return globalInterceptors.combine(registeredInterceptors()); }
private boolean equals(XidImpl other) { return this == other || other != null && XidTransactionID.this.equals(other.getXidTransactionID()); }