@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 synchronized void start(StartContext context) throws StartException { // Register the http request processor on the mgmt request tracker final ManagementHttpRequestProcessor processor = processorValue.getValue(); trackerService = mgmtChannelRegistry.getValue().getTrackerService(); trackerService.registerTracker(processor); processor.addShutdownListener(new ManagementHttpRequestProcessor.ShutdownListener() { @Override public void handleCompleted() { trackerService.unregisterTracker(processor); } }); }
@Override public synchronized void start(StartContext context) throws StartException { // Register the http request processor on the mgmt request tracker final ManagementHttpRequestProcessor processor = processorValue.getValue(); trackerService = mgmtChannelRegistry.getValue().getTrackerService(); trackerService.registerTracker(processor); processor.addShutdownListener(new ManagementHttpRequestProcessor.ShutdownListener() { @Override public void handleCompleted() { trackerService.unregisterTracker(processor); } }); }