/** * Try to connect to the remote host. * * @throws IOException */ protected void connect() throws IOException { // Connect to the remote HC connectionManager.connect(); }
/** * Try to connect to the remote host. * * @throws IOException */ protected void connect() throws IOException { // Connect to the remote HC connectionManager.connect(); }
/** * Try to connect to the remote host. * * @throws IOException */ protected void connect() throws IOException { // Connect to the remote HC connectionManager.connect(); }
@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 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 Channel getChannel() throws IOException { Channel channel = super.getChannel(); if(channel != null) { return channel; } // Try to connect and wait for the channel connectionManager.connect(); // In case connect did not succeed the next getChannel() call needs to try to reconnect channel = super.getChannel(); if(channel == null) { throw ProtocolMessages.MESSAGES.channelClosed(); } return channel; }
@Override public Connection call() throws Exception { final ReconnectPolicy reconnectPolicy = ReconnectPolicy.RECONNECT; int reconnectionCount = 0; for(;;) { try { // reconnectPolicy.wait(reconnectionCount); HostControllerLogger.ROOT_LOGGER.debugf("trying to reconnect to remote host-controller"); // Try to the connect to the remote host controller return connectionManager.connect(); } catch (IOException e) { HostControllerLogger.ROOT_LOGGER.debugf(e, "failed to reconnect to the remote host-controller"); } finally { reconnectionCount++; } } } });
private Connection connect(RemoteDomainControllerConnectionConfiguration remoteDcConfig) throws URISyntaxException, IOException, SlaveRegistrationException { URI masterURI = new URI(remoteDcConfig.getProtocol(), null, remoteDcConfig.getHost(), remoteDcConfig.getPort(), null, null, null); setUri(masterURI); HostControllerLogger.ROOT_LOGGER.debugf("trying to reconnect to remote host-controller at %s", masterURI); Connection connection = connectionManager.connect(); HostControllerLogger.ROOT_LOGGER.connectedToMaster(masterURI); return connection; }
private Connection connect(RemoteDomainControllerConnectionConfiguration remoteDcConfig) throws URISyntaxException, IOException, SlaveRegistrationException { URI masterURI = new URI(remoteDcConfig.getProtocol(), null, remoteDcConfig.getHost(), remoteDcConfig.getPort(), null, null, null); setUri(masterURI); HostControllerLogger.ROOT_LOGGER.debugf("trying to reconnect to remote host-controller at %s", masterURI); Connection connection = connectionManager.connect(); HostControllerLogger.ROOT_LOGGER.connectedToMaster(masterURI); return connection; }
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * @return the boot operations * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler)); ok = true; } finally { if(!ok) { connection.close(); } } }
final Connection connection = connectionManager.connect(); try {
final Connection connection = connectionManager.connect(); try {
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * @return the boot operations * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_SUBJECT, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler)); ok = true; } finally { if(!ok) { connection.close(); } } }
final Connection connection = connectionManager.connect(); try {
final Connection connection = connectionManager.connect(); try {
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
/** * Connect to the HC and retrieve the current model updates. * * @param controller the server controller * @param callback the operation completed callback * * @throws IOException for any error */ synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }