/** * Try to connect to the remote host. * * @throws IOException */ protected void connect() throws IOException { // Connect to the remote HC connectionManager.connect(); }
/** * Create a new connection manager, which will try to connect using the protocol connection configuration. * * @param configuration the connection configuration * @param openHandler the connection open handler * @return the connection manager */ public static ProtocolConnectionManager create(final ProtocolConnectionConfiguration configuration, final ConnectionOpenHandler openHandler) { return create(new EstablishingConnection(configuration, openHandler)); }
@Override public void close() throws IOException { try { super.close(); } finally { connectionManager.shutdown(); } }
if(connectionManager.isConnected()) { try { final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); final Connection connection = connectionManager.getConnection(); StreamUtils.safeClose(connection); if(connection != null) { final Connection connection = connectionManager.connect(); try {
/** * Create a new connection manager. * * @param connectTask the connect connectTask * @return the connection manager */ public static ProtocolConnectionManager create(final ConnectTask connectTask) { return new ProtocolConnectionManager(connectTask); }
if(connectionManager.isConnected()) { try { final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); final Connection connection = connectionManager.getConnection(); StreamUtils.safeClose(connection); if(connection != null) { final Connection connection = connectionManager.connect(); try {
/** * Create a new connection manager. * * @param connectTask the connect connectTask * @return the connection manager */ public static ProtocolConnectionManager create(final ConnectTask connectTask) { return new ProtocolConnectionManager(connectTask); }
/** * Create a new connection manager, which will try to connect using the protocol connection configuration. * * @param configuration the connection configuration * @param openHandler the connection open handler * @return the connection manager */ public static ProtocolConnectionManager create(final ProtocolConnectionConfiguration configuration, final ConnectionOpenHandler openHandler) { return create(new EstablishingConnection(configuration, openHandler)); }
if(connectionManager.isConnected()) { try { final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); final Connection connection = connectionManager.getConnection(); StreamUtils.safeClose(connection); if(connection != null) { final Connection connection = connectionManager.connect(); try {
/** * Try to connect to the remote host. * * @throws IOException */ protected void connect() throws IOException { // Connect to the remote HC connectionManager.connect(); }
@Override public void close() throws IOException { try { super.close(); } finally { connectionManager.shutdown(); } }
/** * Create a new connection manager. * * @param connectTask the connect connectTask * @return the connection manager */ public static ProtocolConnectionManager create(final ConnectTask connectTask) { return new ProtocolConnectionManager(connectTask); }
/** * Create a new connection manager, based on an existing connection. * * @param connection the existing connection * @param openHandler a connection open handler * @return the connected manager */ public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) { return create(new EstablishedConnection(connection, openHandler)); }
if(connectionManager.isConnected()) { try { final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult(); final Connection connection = connectionManager.getConnection(); StreamUtils.safeClose(connection); if(connection != null) { final Connection connection = connectionManager.connect(); try {
/** * Try to connect to the remote host. * * @throws IOException */ protected void connect() throws IOException { // Connect to the remote HC connectionManager.connect(); }
@Override public void close() throws IOException { try { connectionManager.shutdown(); } finally { super.close(); } }
/** * Create a new connection manager, based on an existing connection. * * @param connection the existing connection * @param openHandler a connection open handler * @return the connected manager */ public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) { return create(new EstablishedConnection(connection, openHandler)); }
@Override public Channel getChannel() throws IOException { Channel channel = super.getChannel(); if(channel != null) { return channel; } // Try to connect and wait for the channel synchronized (connectionManager) { deadline = System.currentTimeMillis() + timeout; // read in openChannel below connectionManager.connect(); deadline = null; } // In case connect did not succeed the next getChannel() call needs to try to reconnect channel = super.getChannel(); if(channel == null) { throw ProtocolLogger.ROOT_LOGGER.channelClosed(); } return channel; }
@Override public void close() throws IOException { try { connectionManager.shutdown(); } finally { super.close(); } }
/** * Create a new connection manager, based on an existing connection. * * @param connection the existing connection * @param openHandler a connection open handler * @return the connected manager */ public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) { return create(new EstablishedConnection(connection, openHandler)); }