@Override public void stop(final StopContext context) { value.close(); value = null; moduleAvailabilityListener.close(); moduleAvailabilityListener = null; mutableDiscoveryProvider.setDiscoveryProvider(DiscoveryProvider.EMPTY); synchronized (serviceLock) { cachedServiceURL = null; ourModules.clear(); } }
private static Affinity getWeakAffinity(final StatefulSessionComponent statefulSessionComponent, final StatefulEJBLocator<?> statefulEJBLocator) { final SessionID sessionID = statefulEJBLocator.getSessionId(); return getWeakAffinity(statefulSessionComponent, sessionID); }
final String beanName = ejbIdentifier.getBeanName(); final EjbDeploymentInformation ejbDeploymentInformation = findEJB(appName, moduleName, distinctName, beanName); final Method invokedMethod = findMethod(componentView, invocationRequest.getMethodLocator()); if (invokedMethod == null) { invocationRequest.writeNoSuchMethod(); updateAffinities(invocationRequest, attachments, ejbLocator, componentView); requestContent.writeInvocationResult(null); } else if(isAsync) { result = invokeMethod(componentView, invokedMethod, invocationRequest, requestContent, cancellationFlag, contextDataHolder); attachments.putAll(contextDataHolder); } catch (EJBComponentUnavailableException ex) { updateAffinities(invocationRequest, attachments, ejbLocator, componentView); requestContent.writeInvocationResult(result); } catch (Throwable ioe) { execute(invocationRequest, runnable, isAsync); return cancellationFlag::cancel;
final String distinctName = ejbIdentifier.getDistinctName(); final EjbDeploymentInformation ejbDeploymentInformation = findEJB(appName, moduleName, distinctName, beanName); if (ejbDeploymentInformation == null) { sessionOpenRequest.writeNoSuchEJB(); Affinity clusterAffinity = getClusterAffinity(); if (clusterAffinity != null) { sessionOpenRequest.updateStrongAffinity(clusterAffinity); Affinity weakAffinity = getWeakAffinity(statefulSessionComponent, sessionID); if (weakAffinity != null && !Affinity.NONE.equals(weakAffinity)) { sessionOpenRequest.updateWeakAffinity(weakAffinity); execute(sessionOpenRequest, runnable, false); return ignored -> cancelled.set(true);
private void updateAffinities(InvocationRequest invocationRequest, Map<String, Object> attachments, EJBLocator<?> ejbLocator, ComponentView componentView) { Affinity legacyAffinity = null; Affinity weakAffinity = null; Affinity clusterAffinity = getClusterAffinity(); if (ejbLocator.isStateful() && componentView.getComponent() instanceof StatefulSessionComponent) { final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent(); weakAffinity = legacyAffinity = getWeakAffinity(statefulSessionComponent, ejbLocator.asStateful()); } else if (componentView.getComponent() instanceof StatelessSessionComponent) { // V3 and less used cluster affinity as a weak affinity for SLSBs legacyAffinity = clusterAffinity; } // Always use the cluster as the strong affinity, if there is one if (clusterAffinity != null) { invocationRequest.updateStrongAffinity(clusterAffinity); } if (weakAffinity != null && !weakAffinity.equals(Affinity.NONE)) { invocationRequest.updateWeakAffinity(weakAffinity); } if (legacyAffinity != null && !legacyAffinity.equals(Affinity.NONE)) { attachments.put(Affinity.WEAK_AFFINITY_CONTEXT_KEY, legacyAffinity); } }
interceptorContext.putPrivateData(CancellationFlag.class, cancellationFlag); final Object result = invokeWithIdentity(componentView, interceptorContext, securityIdentity); handleReturningContextData(contextDataHolder, interceptorContext, content); return result == null ? null : ((Future<?>) result).get(); } else { Object result = invokeWithIdentity(componentView, interceptorContext, securityIdentity); handleReturningContextData(contextDataHolder, interceptorContext, content); return result;
value = new AssociationImpl(deploymentRepositoryInjector.getValue(), clientMappingsRegistry); moduleAvailabilityListener = value.registerModuleAvailabilityListener(new ModuleAvailabilityListener() {