private void disposeDecoderOut(IoSession session) { session.removeAttribute(DECODER_OUT); }
private void removeSessionBuffer(IoSession session) { ByteBuffer buf = (ByteBuffer) session.removeAttribute(BUFFER); if (buf != null) { buf.release(); } }
public void dispose(final IoSession session) throws Exception { final Context ctx = (Context) session.getAttribute(CONTEXT); if (ctx != null) { // TODO: Re-enable this!! //ctx.getBuffer().release(); session.removeAttribute(CONTEXT); } }
private void disposeEncoder(IoSession session) { ProtocolEncoder encoder = (ProtocolEncoder) session .removeAttribute(ENCODER); if (encoder == null) { return; } try { encoder.dispose(session); } catch (Throwable t) { SessionLog.warn(session, "Failed to dispose: " + encoder.getClass().getName() + " (" + encoder + ')'); } }
private void disposeDecoder(IoSession session) { ProtocolDecoder decoder = (ProtocolDecoder) session .removeAttribute(DECODER); if (decoder == null) { return; } try { decoder.dispose(session); } catch (Throwable t) { SessionLog.warn(session, "Falied to dispose: " + decoder.getClass().getName() + " (" + decoder + ')'); } }
public void execute(NextCommand next, IoSession session, Object message) throws Exception { if (next != null) { session.setAttribute(NEXT_COMMAND, next); } try { callNextCommand(head, session, message); } finally { session.removeAttribute(NEXT_COMMAND); } }
public void fireExceptionCaught(IoSession session, Throwable cause) { // Notify the related ConnectFuture // if the session is created from SocketConnector. ConnectFuture future = (ConnectFuture) session .removeAttribute(CONNECT_FUTURE); if (future == null) { Entry head = this.head; callNextExceptionCaught(head, session, cause); } else { // Please note that this place is not the only place that // calls ConnectFuture.setException(). future.setException(cause); } }
private void release(IoSession session, int size) { synchronized (session) { int counter = Math.max(0, getCounter(session) - size); session.setAttribute(COUNTER, new Integer(counter)); if (counter < maximumConnectionBufferSize && isSuspendedReads(session)) { session.resumeRead(); session.removeAttribute(SUSPENDED_READS); } } }
public void dispose(IoSession session) throws Exception { Context ctx = (Context) session.getAttribute(CONTEXT); if (ctx != null) { ctx.getBuffer().release(); session.removeAttribute(CONTEXT); } }
/** * Stop collecting stats. all the {@link IoSessionStat} object will be removed of the * polled session attachements. */ public void stop() { synchronized (this) { if (worker == null) { return; } service.removeListener(serviceListener); // stop worker worker.stop = true; worker.interrupt(); while (worker.isAlive()) { try { worker.join(); } catch (InterruptedException e) { //ignore since this is shutdown time } } for (Iterator iter = polledSessions.iterator(); iter.hasNext();) { IoSession session = (IoSession) iter.next(); session.removeAttribute(KEY); } polledSessions.clear(); worker = null; } }
public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { try { session.getHandler().sessionOpened(session); } finally { // Notify the related ConnectFuture // if the session is created from SocketConnector. ConnectFuture future = (ConnectFuture) session .removeAttribute(CONNECT_FUTURE); if (future != null) { future.setSession(session); } } }
session.removeAttribute(CURRENT_STREAM); WriteFuture writeFuture = (WriteFuture) session .removeAttribute(INITIAL_WRITE_FUTURE); .removeAttribute(WRITE_REQUEST_QUEUE); if (queue != null) { WriteRequest wr = queue.poll();
private void removeSession(IoSession session) { // remove the session from the list of polled sessions polledSessions.remove(session); // add the bytes processed between last polling and session closing // prevent non seen byte with non-connected protocols like HTTP and datagrams IoSessionStat sessStat = (IoSessionStat) session.getAttribute(KEY); // computing with time between polling and closing long currentTime = System.currentTimeMillis(); synchronized (calcLock) { bytesReadThroughput += (session.getReadBytes() - sessStat.lastByteRead) / ((currentTime - sessStat.lastPollingTime) / 1000f); bytesWrittenThroughput += (session.getWrittenBytes() - sessStat.lastByteWrite) / ((currentTime - sessStat.lastPollingTime) / 1000f); msgReadThroughput += (session.getReadMessages() - sessStat.lastMessageRead) / ((currentTime - sessStat.lastPollingTime) / 1000f); msgWrittenThroughput += (session.getWrittenMessages() - sessStat.lastMessageWrite) / ((currentTime - sessStat.lastPollingTime) / 1000f); } session.removeAttribute(KEY); }