channel.closeAsync(); channel.addCloseHandler((closed, exception) -> futureResult.setException(e));
@Override public void closeAsync() { // shutdown the executor service try { if (this.executor != null) { this.executor.shutdown(); } } catch (Exception e) { // log and ignore log.debug("Could not shutdown executor service", e); } channel.closeAsync(); }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, serviceType, channelOptions); if(setChannel(channel)) { channel.receiveMessage(receiver); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, serviceType, channelOptions); if(setChannel(channel)) { channel.receiveMessage(receiver); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, serviceType, channelOptions); if(setChannel(channel)) { channel.receiveMessage(receiver); } else { channel.closeAsync(); } }
@Override public void channelOpened(Channel channel) { // When the server/host is stopping we don't accept new connections // this should be using the graceful shutdown control if(closed) { log.debugf("server shutting down, closing channel %s.", channel); channel.closeAsync(); return; } final T createdChannel = createChannel(channel); channels.add(createdChannel); channel.addCloseHandler(new CloseHandler<Channel>() { public void handleClose(final Channel closed, final IOException exception) { channels.remove(createdChannel); log.tracef("Handling close for %s", createdChannel); } }); }
@Override public void channelOpened(Channel channel) { // When the server/host is stopping we don't accept new connections // this should be using the graceful shutdown control if(closed) { RemotingLogger.ROOT_LOGGER.debugf("server shutting down, closing channel %s.", channel); channel.closeAsync(); return; } final ManagementChannelShutdownHandle handle = handleChannelOpened(channel); trackerService.registerTracker(handle); handles.add(handle); channel.addCloseHandler(new CloseHandler<Channel>() { public void handleClose(final Channel closed, final IOException exception) { handles.remove(handle); handle.shutdownNow(); trackerService.unregisterTracker(handle); RemotingLogger.ROOT_LOGGER.tracef("Handling close for %s", handle); } }); }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, SERVER_CHANNEL_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, SERVER_CHANNEL_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, SERVER_CHANNEL_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, SERVER_CHANNEL_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { if (runningMode == RunningMode.ADMIN_ONLY) { // Fetch the domain configuration channelHandler.executeRequest(new FetchDomainConfigurationRequest(), null).getResult().get(); } else { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
@Override public void connectionOpened(final Connection connection) throws IOException { final Channel channel = openChannel(connection, CHANNEL_SERVICE_TYPE, configuration.getOptionMap()); if(setChannel(channel)) { channel.receiveMessage(channelHandler.getReceiver()); channel.addCloseHandler(channelHandler); try { if (runningMode == RunningMode.ADMIN_ONLY) { // Fetch the domain configuration channelHandler.executeRequest(new FetchDomainConfigurationRequest(), null).getResult().get(); } else { // Start the registration process channelHandler.executeRequest(new RegisterHostControllerRequest(), null).getResult().get(); } } catch (Exception e) { if(e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new IOException(e); } // Registered registered(); } else { channel.closeAsync(); } }
channel.closeAsync(); channel.addCloseHandler((closed, exception) -> futureResult.setException(e));
channel.closeAsync(); channel.addCloseHandler((closed, exception) -> futureResult.setException(e));