public void notifyRegistered(final EJBReceiverContext receiverContext) { final EJBClientContext clientContext = receiverContext.getClientContext(); clientContext.putAttachmentIfAbsent(ATTACHMENT_KEY, new RemoteEJBReceiver(this, receiverContext, new RemotingEJBDiscoveryProvider())); }
protected SessionID createSession(final EJBReceiverSessionCreationContext context) throws Exception { final StatelessEJBLocator<?> statelessLocator = context.getClientInvocationContext().getLocator().asStateless(); final AuthenticationContext authenticationContext = context.getAuthenticationContext(); try { IoFuture<ConnectionPeerIdentity> futureConnection = getConnection(context.getClientInvocationContext(), context.getClientInvocationContext().getDestination(), authenticationContext); final ConnectionPeerIdentity identity = futureConnection.getInterruptibly(); final EJBClientChannel ejbClientChannel = getClientChannel(identity.getConnection()); final StatefulEJBLocator<?> result = ejbClientChannel.openSession(statelessLocator, identity, context.getClientInvocationContext()); return result.getSessionId(); } catch (IOException e) { final RequestSendFailedException failed = new RequestSendFailedException("Failed to create stateful EJB: " + e.getMessage(), true); failed.initCause(e); throw failed; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CreateException("Stateful EJB creation interrupted"); } }
public void configure(final Consumer<DiscoveryProvider> discoveryProviderConsumer, final Consumer<RegistryProvider> registryProviderConsumer) { discoveryProviderConsumer.accept((serviceType, filterSpec, result) -> { final RemoteEJBReceiver receiver = EJBClientContext.getCurrent().getAttachment(RemoteTransportProvider.ATTACHMENT_KEY); if (receiver == null) { result.complete(); return DiscoveryRequest.NULL; } return receiver.getDiscoveredNodeRegistry().discover(serviceType, filterSpec, result); }); } }
for (EJBClientConnection connection : ejbReceiver.getReceiverContext().getClientContext().getConfiguredConnections()) { if (connection.isForDiscovery()) { everything.add(connection.getDestination()); for (CidrAddressTable.Mapping<InetSocketAddress> mapping : addressTable) { final InetSocketAddress destination = mapping.getValue(); final InetSocketAddress source = ejbReceiver.getSourceAddress(destination); if (source == null ? mapping.getRange().getNetmaskBits() == 0 : source.equals(destination)) { try {
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(); } }
protected void processInvocation(final EJBReceiverInvocationContext receiverContext) throws Exception { final AuthenticationContext authenticationContext = receiverContext.getAuthenticationContext(); final IoFuture<ConnectionPeerIdentity> futureConnection = getConnection(receiverContext.getClientInvocationContext(), receiverContext.getClientInvocationContext().getDestination(), authenticationContext); // this actually causes the invocation to move forward futureConnection.addNotifier(notifier, receiverContext); }
void connectAndDiscover(URI uri, String clusterEffective) { final String scheme = uri.getScheme(); if (scheme == null || ! ejbReceiver.getRemoteTransportProvider().supportsProtocol(scheme) || ! endpoint.isValidUriScheme(scheme)) { countDown(); return; } outstandingCount.getAndIncrement(); final IoFuture<ConnectionPeerIdentity> future = doPrivileged((PrivilegedAction<IoFuture<ConnectionPeerIdentity>>) () -> getConnectedIdentityUsingClusterEffective(endpoint, uri, "ejb", "jboss", authenticationContext, clusterEffective)); onCancel(future::cancel); future.addNotifier(outerNotifier, uri); }
for (CidrAddressTable.Mapping<InetSocketAddress> mapping : addressTable) { final InetSocketAddress destination = mapping.getValue(); final InetSocketAddress source = ejbReceiver.getSourceAddress(destination); if (source == null ? mapping.getRange().getNetmaskBits() == 0 : source.equals(destination)) { try {
for (EJBClientConnection connection : ejbReceiver.getReceiverContext().getClientContext().getConfiguredConnections()) { if (connection.isForDiscovery()) { everything.add(connection.getDestination()); for (CidrAddressTable.Mapping<InetSocketAddress> mapping : addressTable) { final InetSocketAddress destination = mapping.getValue(); final InetSocketAddress source = ejbReceiver.getSourceAddress(destination); if (source == null ? mapping.getRange().getNetmaskBits() == 0 : source.equals(destination)) { try {
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(); } }
protected void processInvocation(final EJBReceiverInvocationContext receiverContext) throws Exception { final AuthenticationContext authenticationContext = receiverContext.getAuthenticationContext(); final IoFuture<ConnectionPeerIdentity> futureConnection = getConnection(receiverContext.getClientInvocationContext(), receiverContext.getClientInvocationContext().getDestination(), authenticationContext); // this actually causes the invocation to move forward futureConnection.addNotifier(notifier, receiverContext); }
void connectAndDiscover(URI uri, String clusterEffective) { final String scheme = uri.getScheme(); if (scheme == null || ! ejbReceiver.getRemoteTransportProvider().supportsProtocol(scheme) || ! endpoint.isValidUriScheme(scheme)) { countDown(); return; } outstandingCount.getAndIncrement(); final IoFuture<ConnectionPeerIdentity> future = doPrivileged((PrivilegedAction<IoFuture<ConnectionPeerIdentity>>) () -> getConnectedIdentityUsingClusterEffective(endpoint, uri, "ejb", "jboss", authenticationContext, clusterEffective)); onCancel(future::cancel); future.addNotifier(outerNotifier, uri); }
for (CidrAddressTable.Mapping<InetSocketAddress> mapping : addressTable) { final InetSocketAddress destination = mapping.getValue(); final InetSocketAddress source = ejbReceiver.getSourceAddress(destination); if (source == null ? mapping.getRange().getNetmaskBits() == 0 : source.equals(destination)) { try {
protected SessionID createSession(final EJBReceiverSessionCreationContext context) throws Exception { final StatelessEJBLocator<?> statelessLocator = context.getClientInvocationContext().getLocator().asStateless(); final AuthenticationContext authenticationContext = context.getAuthenticationContext(); try { IoFuture<ConnectionPeerIdentity> futureConnection = getConnection(context.getClientInvocationContext(), context.getClientInvocationContext().getDestination(), authenticationContext); final ConnectionPeerIdentity identity = futureConnection.getInterruptibly(); final EJBClientChannel ejbClientChannel = getClientChannel(identity.getConnection()); final StatefulEJBLocator<?> result = ejbClientChannel.openSession(statelessLocator, identity, context.getClientInvocationContext()); return result.getSessionId(); } catch (IOException e) { final RequestSendFailedException failed = new RequestSendFailedException("Failed to create stateful EJB: " + e.getMessage(), true); failed.initCause(e); throw failed; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new CreateException("Stateful EJB creation interrupted"); } }
for (EJBClientConnection connection : ejbReceiver.getReceiverContext().getClientContext().getConfiguredConnections()) { if (connection.isForDiscovery()) { everything.add(connection.getDestination()); for (CidrAddressTable.Mapping<InetSocketAddress> mapping : addressTable) { final InetSocketAddress destination = mapping.getValue(); final InetSocketAddress source = ejbReceiver.getSourceAddress(destination); if (source == null ? mapping.getRange().getNetmaskBits() == 0 : source.equals(destination)) { try {
private void removeNode(final AbstractInvocationContext context) { final Affinity targetAffinity = context.getTargetAffinity(); if (targetAffinity instanceof NodeAffinity) { final RemoteEJBReceiver ejbReceiver = context.getClientContext().getAttachment(RemoteTransportProvider.ATTACHMENT_KEY); if (ejbReceiver != null) { final EJBClientChannel ejbClientChannel = context.getAttachment(RemoteEJBReceiver.EJBCC_KEY); if (ejbClientChannel != null) { final NodeInformation nodeInformation = ejbReceiver.getDiscoveredNodeRegistry().getNodeInformation(((NodeAffinity) targetAffinity).getNodeName()); if (nodeInformation != null) { nodeInformation.removeModule(ejbClientChannel, context.getLocator().getIdentifier().getModuleIdentifier()); } } } } } }
public void notifyRegistered(final EJBReceiverContext receiverContext) { final EJBClientContext clientContext = receiverContext.getClientContext(); clientContext.putAttachmentIfAbsent(ATTACHMENT_KEY, new RemoteEJBReceiver(this, receiverContext, new RemotingEJBDiscoveryProvider())); }
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(); } }
protected void processInvocation(final EJBReceiverInvocationContext receiverContext) throws Exception { final AuthenticationContext authenticationContext = receiverContext.getAuthenticationContext(); final IoFuture<ConnectionPeerIdentity> futureConnection = getConnection(receiverContext.getClientInvocationContext(), receiverContext.getClientInvocationContext().getDestination(), authenticationContext); // this actually causes the invocation to move forward futureConnection.addNotifier(notifier, receiverContext); }
void connectAndDiscover(URI uri, String clusterEffective) { final String scheme = uri.getScheme(); if (scheme == null || ! ejbReceiver.getRemoteTransportProvider().supportsProtocol(scheme) || ! endpoint.isValidUriScheme(scheme)) { countDown(); return; } outstandingCount.getAndIncrement(); final IoFuture<ConnectionPeerIdentity> future = doPrivileged((PrivilegedAction<IoFuture<ConnectionPeerIdentity>>) () -> getConnectedIdentityUsingClusterEffective(endpoint, uri, "ejb", "jboss", authenticationContext, clusterEffective)); onCancel(future::cancel); future.addNotifier(outerNotifier, uri); }