Tabnine Logo
EJBClientContext
Code IndexAdd Tabnine to your IDE (free)

How to use
EJBClientContext
in
org.jboss.ejb.client

Best Java code snippets using org.jboss.ejb.client.EJBClientContext (Showing top 20 results out of 315)

origin: wildfly/wildfly

/**
 * Get the context manager.  Simply calls the {@code static} method {@link #getContextManager()}.
 *
 * @return the context manager (not {@code null})
 */
public ContextManager<EJBClientContext> getInstanceContextManager() {
  return getContextManager();
}
origin: wildfly/wildfly

EJBTransactionOperations(final Connection connection) throws IOException {
  final EJBClientContext ejbClientContext = EJBClientContext.getCurrent();
  final RemoteEJBReceiver receiver = ejbClientContext.getAttachment(RemoteTransportProvider.ATTACHMENT_KEY);
  if (receiver != null) {
    this.channel = receiver.getClientChannel(connection);
  } else {
    throw Logs.REMOTING.noRemoteTransportOnEJBContext();
  }
}
origin: wildfly/wildfly

  public EJBClientContext build() {
    return new EJBClientContext(this);
  }
}
origin: wildfly/wildfly

<T> StatefulEJBLocator<T> createSession(final StatelessEJBLocator<T> statelessLocator, final AuthenticationContext authenticationContext, final NamingProvider namingProvider) throws Exception {
  EJBSessionCreationInvocationContext context = createSessionCreationInvocationContext(statelessLocator, authenticationContext);
  return createSession(context, statelessLocator, namingProvider);
}
origin: wildfly/wildfly

/**
 * Create a new EJB session.
 *
 * @param statelessLocator the stateless locator identifying the stateful EJB
 * @param authenticationContext the authentication context to use for the request and the resultant proxy
 * @param <T> the view type
 * @return the new EJB locator
 * @throws CreateException if an error occurs
 */
static <T> StatefulEJBLocator<T> createSession(StatelessEJBLocator<T> statelessLocator, AuthenticationContext authenticationContext) throws Exception {
  final EJBClientContext clientContext = EJBClientContext.getCurrent();
  return clientContext.createSession(statelessLocator, authenticationContext, null);
}
origin: org.jboss.as/jboss-as-appclient

  @Override
  public ContextSelector<EJBClientContext> run() {
    return EJBClientContext.setSelector(selector);
  }
}
origin: wildfly/wildfly

  return DiscoveryRequest.NULL;
final EJBClientContext ejbClientContext = getCurrent();
final RemoteEJBReceiver ejbReceiver = ejbClientContext.getAttachment(RemoteTransportProvider.ATTACHMENT_KEY);
if (ejbReceiver == null) {
final List<EJBClientConnection> configuredConnections = ejbClientContext.getConfiguredConnections();
  final String clusterName = entry.getKey();
  final Set<String> nodeSet = entry.getValue();
  int maxConnections = ejbClientContext.getMaximumConnectedClusterNodes();
  nodeLoop: for (String nodeName : nodeSet) {
    if (maxConnections <= 0) break;
origin: wildfly/wildfly

static <T> T createSessionProxy(final StatelessEJBLocator<T> statelessLocator, Supplier<AuthenticationContext> authenticationContextSupplier, NamingProvider namingProvider) throws Exception {
  final EJBClientContext clientContext = EJBClientContext.getCurrent();
  // this is the auth context to use just for the invocation
  final AuthenticationContext authenticationContext;
  if (authenticationContextSupplier != null) {
    authenticationContext = authenticationContextSupplier.get();
  } else {
    authenticationContext = AuthenticationContext.captureCurrent();
  }
  final EJBSessionCreationInvocationContext context = clientContext.createSessionCreationInvocationContext(statelessLocator, authenticationContext);
  final StatefulEJBLocator<T> statefulLocator = clientContext.createSession(context, statelessLocator, namingProvider);
  final T proxy = createProxy(statefulLocator, authenticationContextSupplier);
  final Affinity weakAffinity = context.getWeakAffinity();
  if (weakAffinity != null && Affinity.NONE != weakAffinity) {
    setWeakAffinity(proxy, weakAffinity);
  }
  return proxy;
}
origin: wildfly/wildfly

  public EJBReceiver getReceiver(final EJBReceiverContext receiverContext, final String uriScheme) throws IllegalArgumentException {
    switch (uriScheme) {
      case "remote":
      case "remote+http":
      case "remote+https":
      // compatibility
      case "remoting":
      case "http-remoting":
      case "https-remoting": {
        final RemoteEJBReceiver receiver = receiverContext.getClientContext().getAttachment(ATTACHMENT_KEY);
        if (receiver != null) {
          return receiver;
        }
        // else fall through
      }
      default: {
        throw new IllegalArgumentException("Unsupported EJB receiver protocol " + uriScheme);
      }
    }
  }
}
origin: org.jboss/jboss-remote-naming

  private EJBClientContext getContext(final Connection connection) {
    synchronized (contextByConnection) {
      EJBClientContext ret = contextByConnection.get(connection);
      if(ret == null) {
        ret = EJBClientContext.create();
        ret.registerConnection(connection);
        contextByConnection.put(connection, ret);
        connection.addCloseHandler(new CloseHandler<Connection>() {
          @Override
          public void handleClose(final Connection connection, final IOException e) {
            synchronized (contextByConnection) {
              contextByConnection.remove(connection);
            }
          }
        });
      }
      return ret;
    }
  }
}
origin: org.jboss.as/jboss-as-ejb3

@Override
public synchronized void start(StartContext startContext) throws StartException {
  // setup the context with the receivers
  final EJBClientContext context;
  if (this.clientContextClassloader != null) {
    context = EJBClientContext.create(this.ejbClientConfiguration, this.clientContextClassloader);
  } else {
    context = EJBClientContext.create(this.ejbClientConfiguration);
  }
  // add the (optional) local EJB receiver
  final LocalEjbReceiver localEjbReceiver = this.localEjbReceiverInjectedValue.getOptionalValue();
  if (localEjbReceiver != null) {
    context.registerEJBReceiver(localEjbReceiver);
    logger.debug("Added a local EJB receiver to descriptor based EJB client context named " + startContext.getController().getName());
  }
  // now process the remoting receivers
  this.registerRemotingEJBReceivers(startContext, context);
  // we now have a fully configured EJB client context for use
  this.ejbClientContext = context;
}
origin: wildfly/wildfly

if (outerIter.hasNext()) {
  Map<String, Map<EJBMethodLocator, InterceptorList>> targetMap = new HashMap<>(map.size());
  targetMap.put(first.getKey(), calculateMethodInterceptors(first.getValue()));
  do {
    final Map.Entry<String, HashMap<EJBMethodLocator, ArrayList<EJBClientInterceptorInformation>>> next = outerIter.next();
    targetMap.put(next.getKey(), calculateMethodInterceptors(next.getValue()));
  } while (outerIter.hasNext());
  this.configuredPerMethodInterceptors = targetMap;
} else {
  this.configuredPerMethodInterceptors = Collections.singletonMap(first.getKey(), calculateMethodInterceptors(first.getValue()));
origin: org.jboss/jboss-remote-naming

public static RemoteNamingStoreEJBClientHandler setupEJBClientContext(final Properties ejbClientProperties, final List<RemoteContext.CloseTask> closeTasks) {
  EJBClientConfiguration clientConfiguration = new PropertiesBasedEJBClientConfiguration(ejbClientProperties);
  final EJBClientContext ejbClientContext = EJBClientContext.create(clientConfiguration);
  final String ejbClientContextName = EJB_CLIENT_CONTEXT_NAME_PREFIX + nextEJBClientContextNumber.addAndGet(1);
  final EJBClientContextIdentifier ejbClientContextIdentifier = new NamedEJBClientContextIdentifier(ejbClientContextName);
  // register the context with the selector
  registerEJBClientContextWithSelector(ejbClientContextIdentifier, ejbClientContext);
  // add a close task which closes the EJB client context when the remote naming context is closed
  if (closeTasks != null) {
    closeTasks.add(new RemoteNamingEJBClientContextCloseTask(ejbClientContext));
  }
  return new RemoteNamingStoreEJBClientHandler(ejbClientContextIdentifier, ejbClientContext);
}
origin: org.jboss.as/jboss-as-ejb3

  @Override
  public ContextSelector<EJBClientContext> run() {
    return EJBClientContext.setSelector(selector);
  }
}
origin: org.jboss.eap/wildfly-client-all

  return DiscoveryRequest.NULL;
final EJBClientContext ejbClientContext = getCurrent();
final RemoteEJBReceiver ejbReceiver = ejbClientContext.getAttachment(RemoteTransportProvider.ATTACHMENT_KEY);
if (ejbReceiver == null) {
final List<EJBClientConnection> configuredConnections = ejbClientContext.getConfiguredConnections();
  final String clusterName = entry.getKey();
  final Set<String> nodeSet = entry.getValue();
  int maxConnections = ejbClientContext.getMaximumConnectedClusterNodes();
  nodeLoop: for (String nodeName : nodeSet) {
    if (maxConnections <= 0) break;
origin: org.jboss.eap/wildfly-client-all

static <T> T createSessionProxy(final StatelessEJBLocator<T> statelessLocator, Supplier<AuthenticationContext> authenticationContextSupplier, NamingProvider namingProvider) throws Exception {
  final EJBClientContext clientContext = EJBClientContext.getCurrent();
  // this is the auth context to use just for the invocation
  final AuthenticationContext authenticationContext;
  if (authenticationContextSupplier != null) {
    authenticationContext = authenticationContextSupplier.get();
  } else {
    authenticationContext = AuthenticationContext.captureCurrent();
  }
  final EJBSessionCreationInvocationContext context = clientContext.createSessionCreationInvocationContext(statelessLocator, authenticationContext);
  final StatefulEJBLocator<T> statefulLocator = clientContext.createSession(context, statelessLocator, namingProvider);
  final T proxy = createProxy(statefulLocator, authenticationContextSupplier);
  final Affinity weakAffinity = context.getWeakAffinity();
  if (weakAffinity != null && Affinity.NONE != weakAffinity) {
    setWeakAffinity(proxy, weakAffinity);
  }
  return proxy;
}
origin: wildfly/wildfly

@Override
public EJBReceiver getReceiver(EJBReceiverContext ejbReceiverContext, String s) throws IllegalArgumentException {
  if(PROTOCOLS.contains(s)) {
    HttpEJBReceiver receiver = ejbReceiverContext.getClientContext().getAttachment(RECEIVER);
    if(receiver != null) {
      return receiver;
    }
  }
  throw EjbHttpClientMessages.MESSAGES.couldNotCreateHttpEjbReceiverFor(s);
}
origin: org.jboss.eap/wildfly-client-all

<T> StatefulEJBLocator<T> createSession(final StatelessEJBLocator<T> statelessLocator, final AuthenticationContext authenticationContext, final NamingProvider namingProvider) throws Exception {
  EJBSessionCreationInvocationContext context = createSessionCreationInvocationContext(statelessLocator, authenticationContext);
  return createSession(context, statelessLocator, namingProvider);
}
origin: wildfly/jboss-ejb-client

/**
 * Create a new EJB session.
 *
 * @param statelessLocator the stateless locator identifying the stateful EJB
 * @param authenticationContext the authentication context to use for the request and the resultant proxy
 * @param <T> the view type
 * @return the new EJB locator
 * @throws CreateException if an error occurs
 */
static <T> StatefulEJBLocator<T> createSession(StatelessEJBLocator<T> statelessLocator, AuthenticationContext authenticationContext) throws Exception {
  final EJBClientContext clientContext = EJBClientContext.getCurrent();
  return clientContext.createSession(statelessLocator, authenticationContext, null);
}
origin: org.jboss.as/jboss-as-appclient

private synchronized void createConnection() {
  try {
    endpoint = Remoting.createEndpoint("endpoint", OptionMap.EMPTY);
    endpoint.addConnectionProvider("remote", new RemoteConnectionProviderFactory(), OptionMap.create(Options.SSL_ENABLED, Boolean.FALSE));
    // open a connection
    final IoFuture<Connection> futureConnection = endpoint.connect(new URI(hostUrl), OptionMap.create(Options.SASL_POLICY_NOANONYMOUS, Boolean.FALSE, Options.SASL_POLICY_NOPLAINTEXT, Boolean.FALSE), callbackHandler);
    connection = IoFutureHelper.get(futureConnection, 30L, TimeUnit.SECONDS);
    final EJBClientContext ejbClientContext = EJBClientContext.create();
    ejbClientContext.registerConnection(connection);
    this.clientContext = ejbClientContext;
  } catch (IOException e) {
    throw new RuntimeException(e);
  } catch (URISyntaxException e) {
    throw new RuntimeException(e);
  }
}
org.jboss.ejb.clientEJBClientContext

Javadoc

The public API for an EJB client context. An EJB client context may be associated with (and used by) one or more threads concurrently.

Most used methods

  • setSelector
  • getContextManager
    Get the context manager.
  • getAttachment
  • <init>
  • calculateMethodInterceptors
  • create
  • createSession
  • createSessionCreationInvocationContext
  • getClassPathInterceptors
  • getClusterNodeSelector
  • getConfiguredConnections
    Get the pre-configured connections for this context. This information may not be used by some transp
  • getConfiguredPerClassInterceptors
  • getConfiguredConnections,
  • getConfiguredPerClassInterceptors,
  • getConfiguredPerMethodInterceptors,
  • getCurrent,
  • getDeploymentNodeSelector,
  • getGlobalInterceptors,
  • getInterceptors,
  • getInvocationTimeout,
  • getMaximumConnectedClusterNodes,
  • getTransportProvider

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ImageIO (javax.imageio)
  • Reference (javax.naming)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now