public abstract class SessionManager
extends java.lang.Object
This class also stores the system's default session manager.
DefaultSessionManager
,
Session
Modifier and Type | Field and Description |
---|---|
protected int |
cacheSizeLimit
Maxiumum size of the session cache
(default: 0 so that there is no limit).
|
Modifier | Constructor and Description |
---|---|
protected |
SessionManager()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
cacheSession(SSLTransport transport,
Session session)
Add this session to the session cache.
|
int |
getCacheSizeLimit()
Gets the size limit of the session cache.
|
static SessionManager |
getDefault()
Get the current session manager.
|
long |
getResumePeriod()
Returns the resume period of this session manager.
|
protected abstract Session |
getSession(SSLTransport transport,
java.lang.Object sessionID)
Get a session from the session cache.
|
void |
setCacheSizeLimit(int size)
Sets the size limit of the session cache.
|
static void |
setDefault(SessionManager manager)
Set the session manager.
|
void |
setNumberOfTicketsToBeSent(int n)
Sets the number of tickets to be sent to the client.
|
void |
setResumePeriod(long period)
Sets the resume period of cached sessions.
|
protected int cacheSizeLimit
public static SessionManager getDefault()
public static void setDefault(SessionManager manager)
protected abstract void cacheSession(SSLTransport transport, Session session)
session
- the session to cachetransport
- the transportprotected abstract Session getSession(SSLTransport transport, java.lang.Object sessionID)
transport
- the transportsessionID
- a SessionID or null
null
if the session is not in the cache or the
SessionManager wont resume this session; the cached session otherwisepublic void setCacheSizeLimit(int size) throws java.lang.IllegalArgumentException
size
- the size limit of the session cache; a size of 0 indicates
that the session cache size has no limitjava.lang.IllegalArgumentException
- if the given size is < 0.public int getCacheSizeLimit()
public void setResumePeriod(long period)
period
- the resume period in secondspublic long getResumePeriod()
public void setNumberOfTicketsToBeSent(int n)
Only meaningful for TLS 1.3 and on the server side.
In TLS 1.3, after having successfully established a session the server can send one or more NewSessionTicket messages to client. Each NewSessionTicket message contains a ticket the client may use to later indicate a session it wants to resume. With this method the number of tickets (and therefore NewSessionTicket) messages can be configured that a TLS 1.3 server shall send to the client. Each NewSessionTicket message will contain a new ticket but will refer to the same base session to may be resumed later on.
n
- the number of tickets to be sent to the client (default: 1).