Package org.conscrypt
Class AbstractSessionContext
java.lang.Object
org.conscrypt.AbstractSessionContext
- All Implemented Interfaces:
SSLSessionContext
- Direct Known Subclasses:
ClientSessionContext
,ServerSessionContext
Supports SSL session caches.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Maximum lifetime of a session (in seconds) after which it's considered invalid and should not be used to for new connections.private int
private final Map
<ByteArray, NativeSslSession> (package private) final long
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final void
cacheSession
(NativeSslSession session) Adds the given session to the cache.protected void
finalize()
final Enumeration
<byte[]> getIds()
This method is provided for API-compatibility only, not intended for use.final SSLSession
getSession
(byte[] sessionId) This is provided for API-compatibility only, not intended for use.final int
(package private) final NativeSslSession
getSessionFromCache
(byte[] sessionId) Called for server sessions only.(package private) abstract NativeSslSession
getSessionFromPersistentCache
(byte[] sessionId) Called for server sessions only.final int
(package private) abstract void
onBeforeAddSession
(NativeSslSession session) Called when the given session is about to be added.(package private) abstract void
onBeforeRemoveSession
(NativeSslSession session) Called when a session is about to be removed.(package private) final void
removeSession
(NativeSslSession session) Removes the given session from the cache.final void
setSessionCacheSize
(int size) final void
setSessionTimeout
(int seconds) private void
Makes sure cache size is invalid input: '<' maximumSize.
-
Field Details
-
DEFAULT_SESSION_TIMEOUT_SECONDS
private static final int DEFAULT_SESSION_TIMEOUT_SECONDSMaximum lifetime of a session (in seconds) after which it's considered invalid and should not be used to for new connections.- See Also:
-
maximumSize
private volatile int maximumSize -
timeout
private volatile int timeout -
sslCtxNativePointer
final long sslCtxNativePointer -
sessions
-
-
Constructor Details
-
AbstractSessionContext
AbstractSessionContext(int maximumSize) Constructs a new session context.- Parameters:
maximumSize
- of cache
-
-
Method Details
-
getIds
This method is provided for API-compatibility only, not intended for use. No guarantees are made WRT performance.- Specified by:
getIds
in interfaceSSLSessionContext
-
getSession
This is provided for API-compatibility only, not intended for use. No guarantees are made WRT performance or the validity of the returned session.- Specified by:
getSession
in interfaceSSLSessionContext
-
getSessionCacheSize
public final int getSessionCacheSize()- Specified by:
getSessionCacheSize
in interfaceSSLSessionContext
-
getSessionTimeout
public final int getSessionTimeout()- Specified by:
getSessionTimeout
in interfaceSSLSessionContext
-
setSessionTimeout
- Specified by:
setSessionTimeout
in interfaceSSLSessionContext
- Throws:
IllegalArgumentException
-
setSessionCacheSize
- Specified by:
setSessionCacheSize
in interfaceSSLSessionContext
- Throws:
IllegalArgumentException
-
finalize
-
cacheSession
Adds the given session to the cache. -
removeSession
Removes the given session from the cache. -
getSessionFromCache
Called for server sessions only. Retrieves the session by its ID. Overridden byServerSessionContext
to -
onBeforeAddSession
Called when the given session is about to be added. Used byClientSessionContext
to update its host-and-port based cache.Visible for extension only, not intended to be called directly.
-
onBeforeRemoveSession
Called when a session is about to be removed. Used byClientSessionContext
to update its host-and-port based cache.Visible for extension only, not intended to be called directly.
-
getSessionFromPersistentCache
Called for server sessions only. Retrieves the session by ID from the persistent cache.Visible for extension only, not intended to be called directly.
-
trimToSize
private void trimToSize()Makes sure cache size is invalid input: '<' maximumSize.
-