java.lang.Object
net.i2p.sam.SessionRecord

class SessionRecordextends Object
A record of a SAM session stored in the SessionsDB. Contains the destination, properties, and handler for a session.
  • Field Details

    • m_dest

      private final String m_dest
      The session's destination.
    • m_props

      private final Properties m_props
      Options the session was opened with.
    • m_threads

      private final List<Thread> m_threads
      Threads reading and writing for the session.
    • m_handler

      private final SAMv3Handler m_handler
      The handler serving the session's commands.
    • _lastAccessed

      private volatile long _lastAccessed
      When the session was last used, in ms.
  • Constructor Details

    • SessionRecord

      public SessionRecord(String dest, Properties props, SAMv3Handler handler)
      Create a new session record.
      Parameters:
      dest - base64-encoded destination
      props - the session properties, copied into this record
      handler - the SAM handler for this session
    • SessionRecord

      public SessionRecord(SessionRecord in)
      Copy constructor.
      Parameters:
      in - the session record to copy
  • Method Details

    • touch

      void touch()
      Update the last-accessed timestamp. Called by SessionsDB.get(String).
    • getLastAccessed

      long getLastAccessed()
      When this session was last looked up, used for session expiry.
      Returns:
      timestamp of last access via get(), or construction time
    • getDest

      public String getDest()
      Get the base64-encoded destination.
      Returns:
      the destination string
    • getProps

      public Properties getProps()
      Get a copy of the session properties.
      Returns:
      a copy of the properties
    • getHandler

      public SAMv3Handler getHandler()
      Get the SAM handler for this session.
      Returns:
      the SAMv3Handler this record was created with, which is whatever handler the caller's constructor argument supplied
    • getThreads

      public List<Thread> getThreads()
      Get a snapshot of the threads running for this session.
      Returns:
      the session threads, as a copy
    • startThread

      public void startThread(Thread thread)
      Register a new session thread and start it.
      Parameters:
      thread - the thread to register and start