Refine search
public IoFuture<Channel> openChannel(final String serviceType, final OptionMap optionMap) { return delegate.openChannel(serviceType, optionMap); }
RemotingTransactionServer(final RemotingTransactionService transactionService, final Connection connection) { this.transactionService = transactionService; connection.addCloseHandler(this::handleClosed); }
public void close() throws IOException { connectionInfo.connectionClosed(authConfig, futureResult); delegate.close(); }
ProtocolV3ObjectResolver(final Connection connection, final boolean preferUri) { final String remoteEndpointName = connection.getRemoteEndpointName(); peerNodeAffinity = remoteEndpointName == null ? null : new NodeAffinity(remoteEndpointName); final String localEndpointName = connection.getEndpoint().getName(); selfNodeAffinity = localEndpointName == null ? null : new NodeAffinity(localEndpointName); this.preferUri = preferUri; final URI peerURI = connection.getPeerURI(); peerUriAffinity = peerURI == null ? null : (URIAffinity) Affinity.forUri(peerURI); }
public RemotingTransactionServer getServerForConnection(Connection connection) { if (connection.getEndpoint() != endpoint) { throw Log.log.invalidConnectionEndpoint(); } final Attachments attachments = connection.getAttachments(); RemotingTransactionServer server = attachments.getAttachment(KEY); if (server == null) { server = new RemotingTransactionServer(this, connection); RemotingTransactionServer appearing = attachments.attachIfAbsent(KEY, server); if (appearing != null) { server = appearing; } } return server; }
@Override public ManagementChannelHandler startReceiving(Channel channel) { final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, getResponseAttachmentSupport(), getClientRequestExecutor(), channel.getConnection().getLocalIdentity())); channel.receiveMessage(handler.getReceiver()); return handler; } }
final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); UserInfo userInfo = channel.getConnection().getUserInfo(); if (userInfo instanceof SubjectUserInfo) { handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, final HandleableCloseable.Key key = channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(Channel closed, IOException exception) { channel.receiveMessage(handler.getReceiver()); return key;
public SocketAddress getPeerAddress() { return channel.getConnection().getPeerAddress(); }
private SecurityIdentity getSecurityIdentity(int msgId, int invId, int secContext, boolean hasSecContext) { SecurityIdentity securityIdentity; if (hasSecContext) { securityIdentity = channel.getConnection().getLocalIdentity(secContext); } else { securityIdentity = channel.getConnection().getLocalIdentity(); } if(!securityIdentity.implies(RemoteTransactionPermission.getInstance())) { writeExceptionResponse(msgId, invId, P_SEC_EXC, log.noPermission(securityIdentity.getPrincipal().getName(), RemoteTransactionPermission.getInstance())); return null; } return securityIdentity; }
private static IoFuture<RemoteClientTransport> construct(final Channel channel) { FutureResult<RemoteClientTransport> futureResult = new FutureResult<>(channel.getConnection().getEndpoint().getXnioWorker()); channel.receiveMessage(new Channel.Receiver() { public void handleError(final Channel channel, final IOException error) { futureResult.setException(error);
@Override public ManagementChannelHandler startReceiving(Channel channel) { final ManagementChannelHandler handler = new ManagementChannelHandler(ManagementClientChannelStrategy.create(channel), getExecutor()); UserInfo userInfo = channel.getConnection().getUserInfo(); final Subject subject; if (userInfo instanceof SubjectUserInfo) { subject = ((SubjectUserInfo) userInfo).getSubject(); } else { subject = new Subject(); } handler.addHandlerFactory(new ModelControllerClientOperationHandler(getController(), handler, subject)); channel.receiveMessage(handler.getReceiver()); return handler; } }
Channel openChannel(final Connection connection) throws IOException { final IoFuture<Channel> future = connection.openChannel(DEFAULT_CHANNEL_SERVICE_TYPE, OptionMap.EMPTY); final Channel channel = future.get(); channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel old, final IOException e) { synchronized (ChannelStrategy.this) { if(ChannelStrategy.this.channel == old) { ChannelStrategy.this.channel = null; } } handler.handleChannelClosed(old, e); } }); return channel; }
public Executor getRequestExecutor() { return channel.getConnection().getEndpoint().getXnioWorker(); }
@Override public void handleClose(final Channel closed, final IOException exception) { if(CLIModelControllerClient.this.state.get() == CLOSED) { return; } if(CLIModelControllerClient.this.state.compareAndSet(CONNECTING, LOST_CONNECTION)) { return; } synchronized(lock) { if (strategy != null) { if(strategy != originalStrategy) { new Exception("Channel close handler " + strategy + " " + originalStrategy).printStackTrace(); } strategy = null; closeHandler.handleClose(); } channelAssociation.handleChannelClosed(closed, exception); lock.notifyAll(); } // Closing the strategy in this handler may result in race conditions // with connection closing and then deadlocks in remoting // it's safer to close the strategy from the connection close handler closed.getConnection().addCloseHandler(new CloseHandler<Connection>(){ @Override public void handleClose(Connection closed, IOException exception) { StreamUtils.safeClose(originalStrategy); }}); } }
final Attachments attachments = connection.getAttachments(); final FutureResult<T> futureResult = new FutureResult<>(connection.getEndpoint().getXnioWorker()); final IoFuture<T> future = futureResult.getIoFuture(); existing = attachments.attachIfAbsent(key, future); final IoFuture<Channel> futureChannel = connection.openChannel(serviceName, optionMap); futureChannel.addNotifier(new IoFuture.HandlingNotifier<Channel, FutureResult<T>>() { public void handleCancelled(final FutureResult<T> futureResult) {
@Override public void handleEvent(final Event event) throws IOException { UserInfo userInfo = channel.getConnection().getUserInfo(); final Subject subject; if (userInfo instanceof SubjectUserInfo) { subject = ((SubjectUserInfo) userInfo).getSubject(); } else { subject = new Subject(); } try { AccessAuditContext.doAs(subject, new PrivilegedExceptionAction<Void>() { @Override public Void run() throws IOException { SecurityActions.currentAccessAuditContext().setAccessMechanism(AccessMechanism.JMX); event.run(); return null; } }); } catch (PrivilegedActionException e) { Exception cause = e.getException(); if (cause instanceof IOException) { throw (IOException) cause; } else { throw new IOException(cause); } } }
@Override public SecurityIdentity getSecurityIdentity() { return connection.getLocalIdentity(); } }
connection.close(); } catch (Exception e) { connection = IoFutureHelper.get(futureConnection, connectionInfo.getConnectionTimeout(), TimeUnit.MILLISECONDS); final IoFuture<Channel> futureChannel = connection.openChannel("naming", connectionInfo.getChannelCreationOptions()); final Channel channel = IoFutureHelper.get(futureChannel, connectionInfo.getChannelCreationTimeout(), TimeUnit.MILLISECONDS); store = RemoteContextFactory.createVersionedStore(channel, ejbClientHandler); if (connection != null) { try { connection.close(); } catch (IOException e1) { logger.debug("Failed to close connection " + connectionUri, e);
public SocketAddress getPeerAddress() { return delegate.getPeerAddress(); }
public void closeAsync() { connectionInfo.connectionClosed(authConfig, futureResult); delegate.closeAsync(); }