*/
public class ModelControllerClientOperationHandlerFactoryService extends AbstractModelControllerOperationHandlerFactoryService {
@Override
public synchronized HandleableCloseable.Key startReceiving(Channel channel) {
final ManagementMessageHandler handler = new ModelControllerClientOperationHandler(getController(), getExecutor());
final Channel.Receiver receiver = ManagementChannelReceiver.createDelegating(handler);
Channel.Key key = channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(100, TimeUnit.MILLISECONDS);
} catch (Exception e) {
ControllerLogger.ROOT_LOGGER.warnf(e , "service shutdown did not complete");
} finally {
handler.shutdownNow();
}
}
});
channel.receiveMessage(receiver);
return key;