@Override public void handleEnd(final Channel channel) { try { channel.close(); } catch (IOException e) { ROOT_LOGGER.errorClosingChannel(e.getMessage()); } }
@Override public void handleError(final Channel channel, final IOException error) { ROOT_LOGGER.tracef(error, "%s error handling incoming data", this); try { channel.close(); } catch (IOException e) { ROOT_LOGGER.errorClosingChannel(e.getMessage()); } }
@After public void stopChannels() throws Exception { for (final Channel channel : channels) { channel.close(); } futureConnection.get().close(); channelServer.close(); channelServer = null; }
@Override public void handleEnd(Channel channel) { try { channel.close(); } catch (IOException e) { // ignore } finally { this.cleanupOnChannelDown(); } }
@Override public void handleError(Channel channel, IOException error) { try { channel.close(); } catch (IOException e) { throw EjbLogger.ROOT_LOGGER.couldNotCloseChannel(e); } finally { this.cleanupOnChannelDown(); } }
@Override public void handleMessage( final Channel channel, final DataInput input, final ManagementProtocolHeader header) throws IOException { final byte type = header.getType(); if (type == ManagementProtocol.TYPE_REQUEST) { final ManagementRequestHeader request = (ManagementRequestHeader) header; handleMessage(channel, input, request); } else { safeWriteResponse(channel, header, MESSAGES.unrecognizedType(type)); channel.close(); } }
public void handleMessage( final Channel channel, final DataInput input, final ManagementRequestHeader header) throws IOException { final byte type = header.getOperationId(); if (type == DomainServerProtocol.REGISTER_REQUEST) { expectHeader(input, DomainServerProtocol.PARAM_SERVER_NAME); final String serverName = input.readUTF(); CONTROLLER_MANAGEMENT_LOGGER.serverRegistered(serverName, channel); executorService.execute( new Runnable() { @Override public void run() { // Create the server mgmt handler final ManagementChannelHandler handler = new ManagementChannelHandler( channel, executorService, new ServerHandlerFactory(serverName)); ServerToHostOperationHandlerFactoryService.this .callback .getValue() .serverCommunicationRegistered( serverName, handler, new ServerInventory.ProxyCreatedCallback() { @Override public void proxyOperationHandlerCreated( final ManagementRequestHandlerFactory handlerFactory) { channel.addCloseHandler( new CloseHandler<Channel>() { @Override public void handleClose(Channel closed, IOException exception) { handler.shutdownNow(); } }); // Send the response once the server is fully registered safeWriteResponse(channel, header, null); // Once the server and handlers are registered, receive the next message handler.addHandlerFactory(handlerFactory); channel.receiveMessage(handler.getReceiver()); } }); } }); } else { safeWriteResponse(channel, header, MESSAGES.unrecognizedType(type)); channel.close(); } }