"this means that the server " + (address != null ? address : "(channel closed)") + " was processing a request but the client went away. The error message was: " + cce.getMessage()); } catch (Exception e) { RpcServer.LOG.warn(Thread.currentThread().getName()
public void bind(InetSocketAddress localAddress) { // 初始化 init(); processor.start(); // 注册 try { processor.register(); } catch (ClosedChannelException e) { throw new NioException("register channel error:" + e.getMessage(), e); } // 绑定 try { processor.bind(localAddress, serverConfig); } catch (IOException e) { throw new NioException("bind channel error:" + e.getMessage(), e); } }
public void bind(InetSocketAddress localAddress) { // 初始化 init(); processor.start(); // 注册 try { processor.register(); } catch (ClosedChannelException e) { throw new NioException("register channel error:" + e.getMessage(), e); } // 绑定 try { processor.bind(localAddress, serverConfig); } catch (IOException e) { throw new NioException("bind channel error:" + e.getMessage(), e); } }
"this means that the server " + (address != null ? address : "(channel closed)") + " was processing a request but the client went away. The error message was: " + cce.getMessage()); } catch (Exception e) { RpcServer.LOG.warn(Thread.currentThread().getName()
private void postRequest(final Request request) throws AgentControlChannelException { if (_link != null) { try { _link.send(request.toBytes()); } catch (final ClosedChannelException e) { s_logger.warn("Unable to post agent control reques: " + request.toString()); throw new AgentControlChannelException("Unable to post agent control request due to " + e.getMessage()); } } else { throw new AgentControlChannelException("Unable to post agent control request as link is not available"); } }
@Override public void doTask(final Task task) { if (task.getType() == Task.Type.CONNECT) { LOGGER.info("Client: Received CONNECT task"); try { LOGGER.info("Sending data to server"); task.getLink().send(getTestBytes()); } catch (ClosedChannelException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); } } else if (task.getType() == Task.Type.DATA) { LOGGER.info("Client: Received DATA task"); } else if (task.getType() == Task.Type.DISCONNECT) { LOGGER.info("Client: Received DISCONNECT task"); stopClient(); } else if (task.getType() == Task.Type.OTHER) { LOGGER.info("Client: Received OTHER task"); } } }
public void registerSelector(Selector selector) { try { // Register the server socket channel, indicating an interest in // accepting new connections serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT); } catch (ClosedChannelException e) { LOGGER.error("This shouldn't happen, ideally...: " + e.getMessage(), e); } }
public void registerConnect(NioCommand command) { try { key = socketChannel.register(command.eventLoop.selector, SelectionKey.OP_CONNECT, command); } catch (ClosedChannelException e) { throw new AerospikeException.Connection("SocketChannel register error: " + e.getMessage()); } }
public void registerConnect(NioCommand command) { try { key = socketChannel.register(command.eventLoop.selector, SelectionKey.OP_CONNECT, command); } catch (ClosedChannelException e) { throw new AerospikeException.Connection("SocketChannel register error: " + e.getMessage()); } }
/** * * @param channel * @param interestOps * @param attachment * @return */ private SelectionKey registerChannel(SelectableChannel channel, int interestOps, Object attachment) { try { return channel.register(selector, interestOps, attachment); } catch (ClosedChannelException e) { removeHandler(channel); logger.error("Could not register channel: {}", e.getMessage()); } return null; }
public void closeOrRegisterForRead(SelectionKey key) { if (key.isValid() && ioLoop.hasKeepAliveTimeout(key.channel())) { try { key.channel().register(key.selector(), SelectionKey.OP_READ, reuseAttachment(key)); prolongKeepAliveTimeout(key.channel()); logger.debug("keep-alive connection. registrating for read."); } catch (ClosedChannelException e) { logger.debug("ClosedChannelException while registrating key for read: {}", e.getMessage()); Closeables.closeQuietly(ioLoop, key.channel()); } } else { // http request should be finished and no 'keep-alive' => close connection logger.debug("Closing finished (non keep-alive) http connection"); Closeables.closeQuietly(ioLoop, key.channel()); } }
@Override public void release( Lock lock ) throws FileLockException { if ( lock == null ) { log.debug( "skip releasing null" ); return; } if ( skipLocking ) { return; } try { lockFiles.remove( lock.getFile() ); lock.close(); } catch ( ClosedChannelException e ) { // skip this one log.debug( "ignore ClosedChannelException: {}", e.getMessage() ); } catch ( IOException e ) { throw new FileLockException( e.getMessage(), e ); } }
logger.error("ClosedChannelException during write(File): {}", e.getMessage()); Closeables.closeQuietly(key.channel());
@Override public void release( Lock lock ) throws FileLockException { if ( lock == null ) { log.debug( "skip releasing null" ); return; } if ( skipLocking ) { return; } try { lockFiles.remove( lock.getFile() ); lock.close(); } catch ( ClosedChannelException e ) { // skip this one log.debug( "ignore ClosedChannelException: {}", e.getMessage() ); } catch ( IOException e ) { throw new FileLockException( e.getMessage(), e ); } }
/** * Iterates over new accepted client channel list and processes them by * initializing them and setting them up for read/write. */ public void processNewChannels() { for (ClientChannelInfo channelInfo : _initializingChannelList) { initializeChannel(channelInfo, _error); if (channelInfo.channel.state() == ChannelState.ACTIVE) { try { addOption(channelInfo.channel, SelectionKey.OP_READ, channelInfo); } catch (ClosedChannelException e) { System.err.println(e.getMessage()); System.exit(-1); } } } }
private void removeChannel(Channel chnl, Error error) { try { removeOption(chnl, SelectionKey.OP_READ); removeOption(chnl, SelectionKey.OP_WRITE); } catch (ClosedChannelException e) { System.out.println("selector remove write failed, Exception: " + e.getMessage()); } if (chnl.state() != ChannelState.INACTIVE) { int ret = chnl.close(error); if (ret < TransportReturnCodes.SUCCESS) { System.out.println("channel.close() failed with return code: " + ret); } } }
/** * flush for write file descriptor and active state. * * @param key the key * @param error the error */ public void flush(SelectionKey key, Error error) { ClientSessionInfo clientSessionInfo = getClientSessionForChannel((Channel)key.attachment()); // flush the data int ret = clientSessionInfo.clientChannel.flush(error); if (ret < TransportReturnCodes.SUCCESS) { System.out.println("Flush() failed with return code: " + error.text()); } else if (ret == TransportReturnCodes.SUCCESS) { // remove write notification try { removeOption(clientSessionInfo.clientChannel, SelectionKey.OP_WRITE); } catch (ClosedChannelException e) { System.out.println("selector remove write notification failed, Exception: " + e.getMessage()); } } }
public void bind(InetSocketAddress localAddress) { // 初始化 init(); processor.start(); // 注册 try { processor.register(); } catch (ClosedChannelException e) { throw new NioException("register channel error:" + e.getMessage(), e); } // 绑定 try { processor.bind(localAddress, serverConfig); } catch (IOException e) { throw new NioException("bind channel error:" + e.getMessage(), e); } }
System.err.println(e.getMessage()); _isShutdown = true; _shutdownCallback.shutdown();
logger.error("ClosedChannelException during flush(): {}", e.getMessage()); Closeables.closeQuietly(protocol.getIOLoop(), key.channel());