RemotingTransactionServer(final RemotingTransactionService transactionService, final Connection connection) { this.transactionService = transactionService; connection.addCloseHandler(this::handleClosed); }
public Key addCloseHandler(final CloseHandler<? super Connection> handler) { return delegate.addCloseHandler(handler); }
ManagedConnection(final Connection delegate, final ConnectionInfo connectionInfo, final AuthenticationConfiguration authConfig, final FutureResult<Connection> futureResult) { this.delegate = delegate; this.connectionInfo = connectionInfo; this.authConfig = authConfig; this.futureResult = futureResult; delegate.addCloseHandler((c, e) -> connectionInfo.connectionClosed(authConfig, futureResult)); }
RemotingTransactionServer(final RemotingTransactionService transactionService, final Connection connection) { this.transactionService = transactionService; connection.addCloseHandler(this::handleClosed); }
RemotingTransactionServer(final RemotingTransactionService transactionService, final Connection connection) { this.transactionService = transactionService; connection.addCloseHandler(this::handleClosed); }
public Key addCloseHandler(final CloseHandler<? super Connection> handler) { return delegate.addCloseHandler(handler); }
ManagedConnection(final Connection delegate, final ConnectionInfo connectionInfo, final AuthenticationConfiguration authConfig, final FutureResult<Connection> futureResult) { this.delegate = delegate; this.connectionInfo = connectionInfo; this.authConfig = authConfig; this.futureResult = futureResult; delegate.addCloseHandler((c, e) -> connectionInfo.connectionClosed(authConfig, futureResult)); }
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; } } }
/** * Try to connect to the remote host controller. * * @param callbackHandler the security callback handler * @return the underlying remoting connection * @throws IOException */ protected Connection connect(final CallbackHandler callbackHandler) throws IOException { if(closed.get()) { throw new IllegalStateException(); } synchronized (this) { if(isConnected()) { return connection; } connection = client.connectSync(callbackHandler, Collections.<String, String>emptyMap(), null); connection.addCloseHandler(new CloseHandler<Connection>() { @Override public void handleClose(Connection old, IOException exception) { synchronized (DomainTestConnection.this) { if(connection == old) { connection = null; } DomainTestConnection.this.notifyAll(); } } }); return connection; } }
/** * Try to connect to the remote host controller. * * @param callbackHandler the security callback handler * @return the underlying remoting connection * @throws IOException */ protected Connection connect(final CallbackHandler callbackHandler) throws IOException { if(closed.get()) { throw new IllegalStateException(); } synchronized (this) { if(isConnected()) { return connection; } connection = ProtocolConnectionUtils.connectSync(clientConfiguration, callbackHandler, Collections.emptyMap(), null); connection.addCloseHandler(new CloseHandler<Connection>() { @Override public void handleClose(Connection old, IOException exception) { synchronized (DomainTestConnection.this) { if(connection == old) { connection = null; } DomainTestConnection.this.notifyAll(); } } }); return connection; } }
@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); }}); } }
@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); }}); } }
ok = true; this.connection = connection; connection.addCloseHandler(new CloseHandler<Connection>() { @Override public void handleClose(Connection closed, IOException exception) {
ok = true; this.connection = connection; connection.addCloseHandler(new CloseHandler<Connection>() { @Override public void handleClose(Connection closed, IOException exception) {
ok = true; this.connection = connection; connection.addCloseHandler(new CloseHandler<Connection>() { @Override public void handleClose(Connection closed, IOException exception) {