static boolean setNamingDestination(final AbstractInvocationContext context, final NamingProvider namingProvider) { final ProviderEnvironment providerEnvironment = namingProvider.getProviderEnvironment(); final List<URI> providerUris = providerEnvironment.getProviderUris(); List<URI> uris = findPreferredURIs(context, providerUris); if (uris == null) { uris = new ArrayList<>(providerUris.size()); for (URI uri : providerUris) { if (!isBlackListed(context, uri)) { uris.add(uri); } } } final int size = uris.size(); if (size == 0) { // we can't discover the location; fail return false; } else if (size == 1) { context.setDestination(uris.get(0)); return true; } else { context.setDestination(uris.get(ThreadLocalRandom.current().nextInt(size))); } if (context instanceof EJBSessionCreationInvocationContext) { DiscoveryEJBClientInterceptor.setupSessionAffinities((EJBSessionCreationInvocationContext)context); } return true; }
public SessionID handleSessionCreation(final EJBSessionCreationInvocationContext context) throws Exception { final NamingProvider namingProvider = context.getAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY); if (namingProvider == null || context.getDestination() != null || context.getLocator().getAffinity() != Affinity.NONE) { return context.proceed(); } else { if (setDestination(context, namingProvider)) try { return context.proceed(); } catch (NoSuchEJBException | RequestSendFailedException e) { processMissingTarget(context); throw e; } else { throw Logs.INVOCATION.noMoreDestinations(); } } }
private static boolean setDestination(final AbstractInvocationContext context, final NamingProvider namingProvider) { if (namingProvider != null) { final URI destination = context.getDestination(); if (destination == null) { final EJBLocator<?> locator = context.getLocator(); if (locator.getAffinity() == Affinity.NONE) { final Affinity weakAffinity = context.getWeakAffinity(); if (weakAffinity == Affinity.NONE) { return setNamingDestination(context, namingProvider); } } } } return true; }
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); } }
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); } }
public void handleInvocation(final EJBClientInvocationContext context) throws Exception { final NamingProvider namingProvider = context.getProxyAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY); if (namingProvider != null) { // make sure the naming provider is available to invocations context.putAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY, namingProvider); } if (namingProvider == null || context.getDestination() != null || context.getLocator().getAffinity() != Affinity.NONE) { context.putAttachment(SKIP_MISSING_TARGET, Boolean.TRUE); context.sendRequest(); } else { if (setDestination(context, namingProvider)) try { context.sendRequest(); } catch (NoSuchEJBException | RequestSendFailedException e) { processMissingTarget(context); throw e; } else { throw Logs.INVOCATION.noMoreDestinations(); } } }
NamingEJBClientInterceptor.setNamingDestination(context, namingProvider);
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); } }
static boolean setNamingDestination(final AbstractInvocationContext context, final NamingProvider namingProvider) { final ProviderEnvironment providerEnvironment = namingProvider.getProviderEnvironment(); final List<URI> providerUris = providerEnvironment.getProviderUris(); List<URI> uris = findPreferredURIs(context, providerUris); if (uris == null) { uris = new ArrayList<>(providerUris.size()); for (URI uri : providerUris) { if (!isBlackListed(context, uri)) { uris.add(uri); } } } final int size = uris.size(); if (size == 0) { // we can't discover the location; fail return false; } else if (size == 1) { context.setDestination(uris.get(0)); return true; } else { context.setDestination(uris.get(ThreadLocalRandom.current().nextInt(size))); } if (context instanceof EJBSessionCreationInvocationContext) { DiscoveryEJBClientInterceptor.setupSessionAffinities((EJBSessionCreationInvocationContext)context); } return true; }
public SessionID handleSessionCreation(final EJBSessionCreationInvocationContext context) throws Exception { final NamingProvider namingProvider = context.getAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY); if (namingProvider == null || context.getDestination() != null || context.getLocator().getAffinity() != Affinity.NONE) { return context.proceed(); } else { if (setDestination(context, namingProvider)) try { return context.proceed(); } catch (NoSuchEJBException | RequestSendFailedException e) { processMissingTarget(context); throw e; } else { throw Logs.INVOCATION.noMoreDestinations(); } } }
private static boolean setDestination(final AbstractInvocationContext context, final NamingProvider namingProvider) { if (namingProvider != null) { final URI destination = context.getDestination(); if (destination == null) { final EJBLocator<?> locator = context.getLocator(); if (locator.getAffinity() == Affinity.NONE) { final Affinity weakAffinity = context.getWeakAffinity(); if (weakAffinity == Affinity.NONE) { return setNamingDestination(context, namingProvider); } } } } return true; }
static boolean setNamingDestination(final AbstractInvocationContext context, final NamingProvider namingProvider) { final ProviderEnvironment providerEnvironment = namingProvider.getProviderEnvironment(); final List<URI> providerUris = providerEnvironment.getProviderUris(); List<URI> uris = findPreferredURIs(context, providerUris); if (uris == null) { uris = new ArrayList<>(providerUris.size()); for (URI uri : providerUris) { if (!isBlackListed(context, uri)) { uris.add(uri); } } } final int size = uris.size(); if (size == 0) { // we can't discover the location; fail return false; } else if (size == 1) { context.setDestination(uris.get(0)); return true; } else { context.setDestination(uris.get(ThreadLocalRandom.current().nextInt(size))); } if (context instanceof EJBSessionCreationInvocationContext) { DiscoveryEJBClientInterceptor.setupSessionAffinities((EJBSessionCreationInvocationContext)context); } return true; }
public SessionID handleSessionCreation(final EJBSessionCreationInvocationContext context) throws Exception { final NamingProvider namingProvider = context.getAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY); if (namingProvider == null || context.getDestination() != null || context.getLocator().getAffinity() != Affinity.NONE) { return context.proceed(); } else { if (setDestination(context, namingProvider)) try { return context.proceed(); } catch (NoSuchEJBException | RequestSendFailedException e) { processMissingTarget(context); throw e; } else { throw Logs.INVOCATION.noMoreDestinations(); } } }
private static boolean setDestination(final AbstractInvocationContext context, final NamingProvider namingProvider) { if (namingProvider != null) { final URI destination = context.getDestination(); if (destination == null) { final EJBLocator<?> locator = context.getLocator(); if (locator.getAffinity() == Affinity.NONE) { final Affinity weakAffinity = context.getWeakAffinity(); if (weakAffinity == Affinity.NONE) { return setNamingDestination(context, namingProvider); } } } } return true; }
public void handleInvocation(final EJBClientInvocationContext context) throws Exception { final NamingProvider namingProvider = context.getProxyAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY); if (namingProvider != null) { // make sure the naming provider is available to invocations context.putAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY, namingProvider); } if (namingProvider == null || context.getDestination() != null || context.getLocator().getAffinity() != Affinity.NONE) { context.putAttachment(SKIP_MISSING_TARGET, Boolean.TRUE); context.sendRequest(); } else { if (setDestination(context, namingProvider)) try { context.sendRequest(); } catch (NoSuchEJBException | RequestSendFailedException e) { processMissingTarget(context); throw e; } else { throw Logs.INVOCATION.noMoreDestinations(); } } }
NamingEJBClientInterceptor.setNamingDestination(context, namingProvider);
public void handleInvocation(final EJBClientInvocationContext context) throws Exception { final NamingProvider namingProvider = context.getProxyAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY); if (namingProvider != null) { // make sure the naming provider is available to invocations context.putAttachment(Keys.NAMING_PROVIDER_ATTACHMENT_KEY, namingProvider); } if (namingProvider == null || context.getDestination() != null || context.getLocator().getAffinity() != Affinity.NONE) { context.putAttachment(SKIP_MISSING_TARGET, Boolean.TRUE); context.sendRequest(); } else { if (setDestination(context, namingProvider)) try { context.sendRequest(); } catch (NoSuchEJBException | RequestSendFailedException e) { processMissingTarget(context); throw e; } else { throw Logs.INVOCATION.noMoreDestinations(); } } }
NamingEJBClientInterceptor.setNamingDestination(context, namingProvider);