public String debug(TcpIpConnectionManager connectionManager) { StringBuffer sb = new StringBuffer(); sb.append("in selectors\n"); for (InSelectorImpl in : connectionManager.getInSelectors()) { sb.append(in + " :" + in.getReadEvents() + "\n"); for (TcpIpConnection connection : connectionManager.getActiveConnections()) { ReadHandler readHandler = connection.getReadHandler(); if (readHandler.getOwner() == in) { sb.append("\t" + readHandler + " eventCount:" + readHandler.getEventCount() + "\n"); } } } sb.append("out selectors\n"); for (OutSelectorImpl in : connectionManager.getOutSelectors()) { sb.append(in + " :" + in.getWriteEvents() + "\n"); for (TcpIpConnection connection : connectionManager.getActiveConnections()) { WriteHandler writeHandler = connection.getWriteHandler(); if (writeHandler.getOwner() == in) { sb.append("\t" + writeHandler + " eventCount:" + writeHandler.getEventCount() + "\n"); } } } return sb.toString(); }
public void close(Throwable t) { if (!live) { return; } try { close0(); } catch (Exception e) { logger.warning(e); } Object connAddress = getConnectionAddress(); String message = "Connection [" + connAddress + "] lost. Reason: "; if (t != null) { message += t.getClass().getName() + "[" + t.getMessage() + "]"; } else { message += "Socket explicitly closed"; } logger.info(message); connectionManager.destroyConnection(this); connectionManager.ioService.onDisconnect(endPoint); if (t != null && monitor != null) { monitor.onError(t); } }
private Map<IOSelector, Set<MigratableHandler>> getHandlersPerSelector( TcpIpConnectionManager connectionManager) { Map<IOSelector, Set<MigratableHandler>> handlersPerSelector = new HashMap<IOSelector, Set<MigratableHandler>>(); for (TcpIpConnection connection : connectionManager.getActiveConnections()) { add(handlersPerSelector, connection.getReadHandler()); add(handlersPerSelector, connection.getWriteHandler()); } return handlersPerSelector; }
public void assertIsDestroyed(TcpIpConnection connection) { TcpIpConnectionManager connectionManager = connection.getConnectionManager(); assertFalse(connection.isAlive()); assertNull(connectionManager.getConnection(connection.getEndPoint())); }
public SocketPacketReader(TcpIpConnection connection) { TcpIpConnectionManager connectionManager = connection.getConnectionManager(); this.packetReader = connectionManager.createPacketReader(connection); }