Package one.nio.net

Class Session

java.lang.Object
one.nio.net.Session
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
HttpSession, RpcSession

public class Session extends Object implements Closeable
  • Field Details

    • log

      protected static final org.apache.commons.logging.Log log
    • READABLE

      public static final int READABLE
      See Also:
    • WRITEABLE

      public static final int WRITEABLE
      See Also:
    • CLOSING

      public static final int CLOSING
      See Also:
    • EVENT_MASK

      public static final int EVENT_MASK
      See Also:
    • SSL

      public static final int SSL
      See Also:
    • ACTIVE

      public static final int ACTIVE
      See Also:
    • IDLE

      public static final int IDLE
      See Also:
    • STALE

      public static final int STALE
      See Also:
    • socket

      protected Socket socket
    • selector

      protected Selector selector
    • slot

      protected int slot
    • events

      protected int events
    • eventsToListen

      protected int eventsToListen
    • wasSelected

      protected boolean wasSelected
    • closing

      protected boolean closing
    • queueHead

      protected Session.QueueItem queueHead
    • lastAccessTime

      protected volatile long lastAccessTime
  • Constructor Details

    • Session

      public Session(Socket socket)
    • Session

      public Session(Socket socket, int eventsToListen)
  • Method Details

    • getRemoteHost

      public final String getRemoteHost()
    • socket

      public final Socket socket()
    • lastAccessTime

      public final long lastAccessTime()
    • isSsl

      public boolean isSsl()
    • checkStatus

      public int checkStatus(long currentTime, long keepAlive)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • scheduleClose

      public void scheduleClose()
    • getQueueStats

      public void getQueueStats(long[] stats)
    • listen

      public void listen(int newEventsToListen)
    • read

      public int read(byte[] data, int offset, int count) throws IOException
      Throws:
      IOException
    • readRaw

      public int readRaw(long address, int count) throws IOException
      Throws:
      IOException
    • write

      public final void write(byte[] data, int offset, int count) throws IOException
      Throws:
      IOException
    • write

      public final void write(byte[] data, int offset, int count, int flags) throws IOException
      Throws:
      IOException
    • write

      public final void write(Session.QueueItem item) throws IOException
      Throws:
      IOException
    • processRead

      protected void processRead(byte[] buffer) throws Exception
      Throws:
      Exception
    • processWrite

      protected void processWrite() throws Exception
      Throws:
      Exception
    • process

      public void process(byte[] buffer) throws Exception
      Throws:
      Exception
    • handleException

      public void handleException(Throwable e)