@Override public void restoreMessageHandler() { MessageHandler handler = backupHandler; setMessageHandler(handler == null ? MessageHandler.NULL : handler); }
@Override public void restoreMessageHandler() { MessageHandler handler = backupHandler; setMessageHandler(handler == null ? MessageHandler.NULL : handler); }
@Override public void restoreMessageHandler() { MessageHandler handler = backupHandler; setMessageHandler(handler == null ? MessageHandler.NULL : handler); }
private void safeHandleConnection(final Socket socket) { boolean ok = false; try { final ConnectionImpl connection = new ConnectionImpl(socket, MessageHandler.NULL, readExecutor, callback); connection.setMessageHandler(connectionHandler.handleConnected(connection)); final Thread thread = threadFactory.newThread(connection.getReadTask()); if (thread == null) { throw ProcessLogger.ROOT_LOGGER.threadCreationRefused(); } thread.setName("Read thread for " + socket.getRemoteSocketAddress()); thread.start(); ok = true; } catch (IOException e) { ProcessLogger.PROTOCOL_CLIENT_LOGGER.failedToHandleIncomingConnection(e); } finally { if (! ok) { try { socket.close(); } catch (IOException e) { ProcessLogger.PROTOCOL_CLIENT_LOGGER.failedToCloseSocket(e); } } } }
private void safeHandleConnection(final Socket socket) { boolean ok = false; try { final ConnectionImpl connection = new ConnectionImpl(socket, MessageHandler.NULL, readExecutor, callback); connection.setMessageHandler(connectionHandler.handleConnected(connection)); final Thread thread = threadFactory.newThread(connection.getReadTask()); if (thread == null) { throw ProcessLogger.ROOT_LOGGER.threadCreationRefused(); } thread.setName("Read thread for " + socket.getRemoteSocketAddress()); thread.start(); ok = true; } catch (IOException e) { ProcessLogger.PROTOCOL_CLIENT_LOGGER.failedToHandleIncomingConnection(e); } finally { if (! ok) { try { socket.close(); } catch (IOException e) { ProcessLogger.PROTOCOL_CLIENT_LOGGER.failedToCloseSocket(e); } } } }
private void safeHandleConnection(final Socket socket) { boolean ok = false; try { final ConnectionImpl connection = new ConnectionImpl(socket, MessageHandler.NULL, readExecutor, callback); connection.setMessageHandler(connectionHandler.handleConnected(connection)); final Thread thread = threadFactory.newThread(connection.getReadTask()); if (thread == null) { throw MESSAGES.threadCreationRefused(); } thread.setName("Read thread for " + socket.getRemoteSocketAddress()); thread.start(); ok = true; } catch (IOException e) { CLIENT_LOGGER.failedToHandleIncomingConnection(e); } finally { if (! ok) { try { socket.close(); } catch (IOException e) { CLIENT_LOGGER.failedToCloseSocket(e); } } } }