/** * Construct a new asynchronous instance. * * @param other the synchronous invocation handler */ EJBInvocationHandler(final EJBInvocationHandler<T> other) { super(other); final EJBLocator<T> locator = other.locatorRef.get(); locatorRef = new AtomicReference<>(locator); authenticationContextSupplier = other.authenticationContextSupplier; async = true; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created setWeakAffinity(locator.getAffinity()); } }
/** * Construct a new instance. * * @param locator the initial EJB locator (not {@code null}) * @param authenticationContextSupplier the sticky authentication context supplier, or {@code null} to always capture the current context */ EJBInvocationHandler(final EJBLocator<T> locator, final Supplier<AuthenticationContext> authenticationContextSupplier) { Assert.checkNotNullParam("locator", locator); this.authenticationContextSupplier = authenticationContextSupplier; this.locatorRef = new AtomicReference<>(locator); async = false; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created setWeakAffinity(locator.getAffinity()); } }
/** * Change the weak affinity of a proxy. All subsequent invocations against the proxy will use the new affinity. * * @param proxy the proxy (may not be {@code null}) * @param newAffinity the new affinity (may not be {@code null}) * @throws IllegalArgumentException if the given proxy is not a valid client proxy instance * @throws SecurityException if a security manager is present and the caller does not have the {@code changeWeakAffinity} {@link EJBClientPermission} */ public static void setWeakAffinity(Object proxy, Affinity newAffinity) throws IllegalArgumentException, SecurityException { Assert.checkNotNullParam("proxy", proxy); Assert.checkNotNullParam("newAffinity", newAffinity); final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(EJBClientPermission.CHANGE_WEAK_AFFINITY); } EJBInvocationHandler.forProxy(proxy).setWeakAffinity(newAffinity); }
if (idx == 0) { invocationHandler.setWeakAffinity(getWeakAffinity()); invocationHandler.setStrongAffinity(getLocator().getAffinity());
/** * Construct a new asynchronous instance. * * @param other the synchronous invocation handler */ EJBInvocationHandler(final EJBInvocationHandler<T> other) { super(other); final EJBLocator<T> locator = other.locatorRef.get(); locatorRef = new AtomicReference<>(locator); authenticationContextSupplier = other.authenticationContextSupplier; async = true; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created setWeakAffinity(locator.getAffinity()); } }
/** * Construct a new asynchronous instance. * * @param other the synchronous invocation handler */ EJBInvocationHandler(final EJBInvocationHandler<T> other) { super(other); final EJBLocator<T> locator = other.locatorRef.get(); locatorRef = new AtomicReference<>(locator); authenticationContextSupplier = other.authenticationContextSupplier; async = true; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created setWeakAffinity(locator.getAffinity()); } }
/** * Construct a new instance. * * @param locator the initial EJB locator (not {@code null}) * @param authenticationContextSupplier the sticky authentication context supplier, or {@code null} to always capture the current context */ EJBInvocationHandler(final EJBLocator<T> locator, final Supplier<AuthenticationContext> authenticationContextSupplier) { Assert.checkNotNullParam("locator", locator); this.authenticationContextSupplier = authenticationContextSupplier; this.locatorRef = new AtomicReference<>(locator); async = false; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created setWeakAffinity(locator.getAffinity()); } }
/** * Construct a new instance. * * @param locator the initial EJB locator (not {@code null}) * @param authenticationContextSupplier the sticky authentication context supplier, or {@code null} to always capture the current context */ EJBInvocationHandler(final EJBLocator<T> locator, final Supplier<AuthenticationContext> authenticationContextSupplier) { Assert.checkNotNullParam("locator", locator); this.authenticationContextSupplier = authenticationContextSupplier; this.locatorRef = new AtomicReference<>(locator); async = false; if (locator instanceof StatefulEJBLocator) { // set the weak affinity to the node on which the session was created setWeakAffinity(locator.getAffinity()); } }
/** * Change the weak affinity of a proxy. All subsequent invocations against the proxy will use the new affinity. * * @param proxy the proxy (may not be {@code null}) * @param newAffinity the new affinity (may not be {@code null}) * @throws IllegalArgumentException if the given proxy is not a valid client proxy instance * @throws SecurityException if a security manager is present and the caller does not have the {@code changeWeakAffinity} {@link EJBClientPermission} */ public static void setWeakAffinity(Object proxy, Affinity newAffinity) throws IllegalArgumentException, SecurityException { Assert.checkNotNullParam("proxy", proxy); Assert.checkNotNullParam("newAffinity", newAffinity); final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(EJBClientPermission.CHANGE_WEAK_AFFINITY); } EJBInvocationHandler.forProxy(proxy).setWeakAffinity(newAffinity); }
/** * Change the weak affinity of a proxy. All subsequent invocations against the proxy will use the new affinity. * * @param proxy the proxy (may not be {@code null}) * @param newAffinity the new affinity (may not be {@code null}) * @throws IllegalArgumentException if the given proxy is not a valid client proxy instance * @throws SecurityException if a security manager is present and the caller does not have the {@code changeWeakAffinity} {@link EJBClientPermission} */ public static void setWeakAffinity(Object proxy, Affinity newAffinity) throws IllegalArgumentException, SecurityException { Assert.checkNotNullParam("proxy", proxy); Assert.checkNotNullParam("newAffinity", newAffinity); final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(EJBClientPermission.CHANGE_WEAK_AFFINITY); } EJBInvocationHandler.forProxy(proxy).setWeakAffinity(newAffinity); }
if (idx == 0) { invocationHandler.setWeakAffinity(getWeakAffinity()); invocationHandler.setStrongAffinity(getLocator().getAffinity());
if (idx == 0) { invocationHandler.setWeakAffinity(getWeakAffinity()); invocationHandler.setStrongAffinity(getLocator().getAffinity());