Class SessionID
java.lang.Object
com.iizix.comm.session.SessionID
- All Implemented Interfaces:
ISessionStatistics
The session ID is used to identify a transaction session that can be used to pick up communication again after a broken link, and also to store additional information about a user and other settings to easy re-establishing a session. This could be e.g. User ID and Passwords entered by the User in various points throughout the UI. This can safely be stored in this instance as it is a volatile instance that do not persist.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic SessionID[]Empty array.static final Stringstatic final StringSession ID properties defined.static final intThe random bytes of a session identifier, 16: 128 bits ofUtilities.getSecureRandom(), rendered as 32 hex characters before the dash and the serial.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionGets the string representation of this SessionID for logging when a complete "dump" is needed for diagnostics, critical errors, etc.Gets the string representation of this SessionID for logging.static SessionID[]Gets all the Session ID's open.static intGets the count of open sessions.Gets the session identifier.Gets the session info.Gets the statistics instance of the session.Gets the Session Transaction Manager.static StringMasks a session identifier for a log line (CC-FIX-RECONNECT-TOKEN): the beginning and the end of its random part with"..."between them, the serial after the dash kept, so that a line can still be found and matched across the server log, the HTTP request log and a support case while the identifier cannot be used to reconnect to the session.toString()The string representation: the identifier masked (maskID(String)) and the remote address once known.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ISessionStatistics
getLastConnectionTime, getProperties, getProperty, setProperty
Field Details
EMPTY
Empty array.PROP_REMOTE_ADDR
PROP_COMM_ERROR
- See Also:
RANDOM_BYTES
public static final int RANDOM_BYTESThe random bytes of a session identifier, 16: 128 bits ofUtilities.getSecureRandom(), rendered as 32 hex characters before the dash and the serial. Six bytes before CC-FIX-RECONNECT-TOKEN (RT-D-1): enough for a handle, too few for the masked form of the log lines to hide 64 random bits (maskID(String)).- See Also:
Constructor Details
SessionID
Constructs the instance.- Parameters:
manager- The session transaction manager.- Throws:
NullPointerException- Ifmanagerisnull.
Method Details
getOpenSessionsCount
public static int getOpenSessionsCount()Gets the count of open sessions.getOpenSessions
Gets all the Session ID's open.maskID
Masks a session identifier for a log line (CC-FIX-RECONNECT-TOKEN): the beginning and the end of its random part with"..."between them, the serial after the dash kept, so that a line can still be found and matched across the server log, the HTTP request log and a support case while the identifier cannot be used to reconnect to the session. The one helper for the form: every line that names a session identifier goes through it, the request log'sreconnectmember too, and the client'smaskSessionIDofiz/communication.jsproduces the same form. A random part of 24 characters or more showsMASK_SHOWNat each end (a 32-hex identifier hides 24, 96 random bits), one of 8 to 23 shows 2 at each end, a shorter one only the dots. A temporary identifier of a reconnecting manager (RECONNECT-n) is no secret and is returned as it is; so is null, and so is a string that holds the dots already: masking twice is masking once (a URL the client masked before it was logged, a line masked again).- Parameters:
id- The session identifier, or whatever string a client presented as one.- Returns:
- The masked form, e.g.
a1b2...e9f0-17; null for null.
getTransactionManager
Gets the Session Transaction Manager.- Returns:
- The instance, never null.
getSessionStatistics
Gets the statistics instance of the session.- Specified by:
getSessionStatisticsin interfaceISessionStatistics- Returns:
- The SessionStatistics instance.
getSessionInfo
Gets the session info.getSessionID
Gets the session identifier.- Returns:
- The session identifier, or null if disposed of.
getLogString
Gets the string representation of this SessionID for logging.getFullLogInfo
Gets the string representation of this SessionID for logging when a complete "dump" is needed for diagnostics, critical errors, etc.toString
The string representation: the identifier masked (maskID(String)) and the remote address once known. Every session line of a server log is built from it (CC-FIX-RECONNECT-TOKEN): the full identifier is a reconnection handle and is written to no log;getSessionID()has it, for the server monitor's end-point record and the session tables.