CONTROLLER_MANAGEMENT_LOGGER.serverRegistered(serverName, channel);
executorService.execute(new Runnable() {
@Override
public void run() {
final Channel mgmtChannel = channel;
ServerToHostOperationHandlerFactoryService.this.callback.getValue().serverRegistered(serverName, mgmtChannel, new ServerInventory.ProxyCreatedCallback() {
@Override
public void proxyOperationHandlerCreated(final ManagementMessageHandler handler) {
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdownNow();
}
});
final Channel.Receiver receiver = ManagementChannelReceiver.createDelegating(handler);
mgmtChannel.receiveMessage(receiver);
// Send the response once the server is fully registered
safeWriteResponse(channel, header, null);
}
});
}