java.lang.Object
net.i2p.sam.SessionRecord
A record of a SAM session stored in the
SessionsDB. Contains the destination, properties, and handler for a session.Field Summary
FieldsModifier and TypeFieldDescriptionprivate longWhen the session was last used, in ms.private final StringThe session's destination.private final SAMv3HandlerThe handler serving the session's commands.private final PropertiesOptions the session was opened with.Threads reading and writing for the session.Constructor Summary
ConstructorsConstructorDescriptionSessionRecord(String dest, Properties props, SAMv3Handler handler) Create a new session record.Copy constructor.Method Summary
Public MethodsModifier and TypeMethodDescriptiongetDest()Get the base64-encoded destination.Get the SAM handler for this session.(package private) longWhen this session was last looked up, used for session expiry.getProps()Get a copy of the session properties.Get a snapshot of the threads running for this session.voidstartThread(Thread thread) Register a new session thread and start it.(package private) voidtouch()Update the last-accessed timestamp.
Field Details
m_dest
The session's destination.m_props
Options the session was opened with.m_threads
m_handler
The handler serving the session's commands._lastAccessed
private volatile long _lastAccessedWhen the session was last used, in ms.
Constructor Details
SessionRecord
Create a new session record.- Parameters:
dest- base64-encoded destinationprops- the session properties, copied into this recordhandler- the SAM handler for this session
SessionRecord
Method Details
touch
void touch()Update the last-accessed timestamp. Called bySessionsDB.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
getProps
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
startThread
Register a new session thread and start it.- Parameters:
thread- the thread to register and start