this.serverProcessName = serverProcessName;
}
/** {@inheritDoc} */
public synchronized void start(final StartContext context) throws StartException {
final Channel channel = hcChannel.getValue();
final HostControllerServerHandler handler = new HostControllerServerHandler(controller.getValue(), executor);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(final Channel closed, final IOException exception) {
handler.shutdownNow();
}
});
// Notify MSC asynchronously when the server gets registered
context.asynchronous();
try {
handler.executeRegistrationRequest(channel, new ServerRegisterRequest(), context);
} catch (Exception e) {
throw ServerMessages.MESSAGES.failedToConnectToHC(e);
}
this.handler = handler;
channel.receiveMessage(ManagementChannelReceiver.createDelegating(handler));
}