log.trace("Session - write queue: {} session count: {}", session.getWriteRequestQueue().size(), session.getService().getManagedSessionCount());
private static boolean isAcceptor(IoSession session) { IoService service = session.getService(); return service instanceof IoAcceptor || service instanceof BridgeAcceptor; }
/** * @see IoSession#getService() */ public IoService getService() { return wrappedSession.getService(); }
@Override public void messageReceived(IoSession session, Object message) throws Exception { for (int i = 0; i < session.getService().getManagedSessions().values().toArray().length; i++) { IoSession aSession=(IoSession) session.getService().getManagedSessions().values().toArray()[i]; aSession.write("Any Message"); } }
@Override public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { ((AbstractIoSession) session).increaseWrittenMessages(writeRequest, System.currentTimeMillis()); // Update the statistics if (session.getService() instanceof AbstractIoService) { ((AbstractIoService) session.getService()).getStatistics().updateThroughput(System.currentTimeMillis()); } // Propagate the message session.getHandler().messageSent(session, writeRequest.getMessage()); }
@Override public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception { ((AbstractIoSession) session).increaseWrittenMessages(writeRequest, System.currentTimeMillis()); // Update the statistics if (session.getService() instanceof AbstractIoService) { ((AbstractIoService) session.getService()).getStatistics().updateThroughput(System.currentTimeMillis()); } // Propagate the message session.getHandler().messageSent(session, writeRequest.getMessage()); }
/** * An extended toString() method for sessions. If the SSL handshake * is not yet completed, we will print (ssl) in small caps. Once it's * completed, we will use SSL capitalized. */ /* no qualifier */String getSessionInfo(IoSession session) { StringBuilder sb = new StringBuilder(); if (session.getService() instanceof IoAcceptor) { sb.append("Session Server"); } else { sb.append("Session Client"); } sb.append('[').append(session.getId()).append(']'); SslHandler sslHandler = (SslHandler) session.getAttribute(SSL_HANDLER); if (sslHandler == null) { sb.append("(no sslEngine)"); } else if (isSslStarted(session)) { if (sslHandler.isHandshakeComplete()) { sb.append("(SSL)"); } else { sb.append("(ssl...)"); } } return sb.toString(); }
private static Logger getTransportLogger(IoSession session) { String loggerName = "transport." + session.getService().getTransportMetadata().getName() + (isAcceptor(session) ? ".accept" : ".connect"); return LoggerFactory.getLogger(loggerName); }
/** * An extended toString() method for sessions. If the SSL handshake * is not yet completed, we will print (ssl) in small caps. Once it's * completed, we will use SSL capitalized. */ /* no qualifier */String getSessionInfo(IoSession session) { StringBuilder sb = new StringBuilder(); if (session.getService() instanceof IoAcceptor) { sb.append("Session Server"); } else { sb.append("Session Client"); } sb.append('[').append(session.getId()).append(']'); SslHandler sslHandler = (SslHandler) session.getAttribute(SSL_HANDLER); if (sslHandler == null) { sb.append("(no sslEngine)"); } else if (isSslStarted(session)) { if (sslHandler.isHandshakeComplete()) { sb.append("(SSL)"); } else { sb.append("(ssl...)"); } } return sb.toString(); }
@Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { AbstractIoSession s = (AbstractIoSession) session; if (!(message instanceof IoBuffer) || !((IoBuffer) message).hasRemaining()) { s.increaseReadMessages(System.currentTimeMillis()); } // Update the statistics if (session.getService() instanceof AbstractIoService) { ((AbstractIoService) session.getService()).getStatistics().updateThroughput(System.currentTimeMillis()); } // Propagate the message try { session.getHandler().messageReceived(s, message); } finally { if (s.getConfig().isUseReadOperation()) { s.offerReadFuture(message); } } }
@Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { AbstractIoSession s = (AbstractIoSession) session; if (!(message instanceof IoBuffer) || !((IoBuffer) message).hasRemaining()) { s.increaseReadMessages(System.currentTimeMillis()); } // Update the statistics if (session.getService() instanceof AbstractIoService) { ((AbstractIoService) session.getService()).getStatistics().updateThroughput(System.currentTimeMillis()); } // Propagate the message try { session.getHandler().messageReceived(s, message); } finally { if (s.getConfig().isUseReadOperation()) { s.offerReadFuture(message); } } }
if (session.getService() instanceof IoConnector) { synchronized (managedSessions) { firstSession = managedSessions.isEmpty();
boolean firstSession = false; if (session.getService() instanceof IoConnector) { synchronized (managedSessions) { firstSession = managedSessions.isEmpty();
boolean firstSession = false; if (session.getService() instanceof IoConnector) { synchronized (managedSessions) { firstSession = managedSessions.isEmpty();
if (session.getService() instanceof IoConnector) { boolean lastSession = false;
if (session.getService() instanceof IoConnector) { boolean lastSession; synchronized (managedSessions) {
if (session.getService() instanceof IoConnector) { boolean lastSession = false;
((AbstractIoSession) session).setAttributeMap(session.getService() .getSessionDataStructureFactory().getAttributeMap(session)); } catch (IoSessionInitializationException e) { .getService().getSessionDataStructureFactory() .getWriteRequestQueue(session)); } catch (IoSessionInitializationException e) {
((AbstractIoSession) session).setAttributeMap(session.getService().getSessionDataStructureFactory() .getAttributeMap(session)); } catch (IoSessionInitializationException e) { ((AbstractIoSession) session).setWriteRequestQueue(session.getService().getSessionDataStructureFactory() .getWriteRequestQueue(session)); } catch (IoSessionInitializationException e) {
((AbstractIoSession) session).setAttributeMap(session.getService().getSessionDataStructureFactory() .getAttributeMap(session)); } catch (IoSessionInitializationException e) { ((AbstractIoSession) session).setWriteRequestQueue(session.getService().getSessionDataStructureFactory() .getWriteRequestQueue(session)); } catch (IoSessionInitializationException e) {