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 intMaximum lifetime of a session (in seconds) after which it's considered invalid and should not be used to for new connections.private intprivate final Map<ByteArray, NativeSslSession> (package private) final longprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final voidcacheSession(NativeSslSession session) Adds the given session to the cache.protected voidfinalize()final Enumeration<byte[]> getIds()This method is provided for API-compatibility only, not intended for use.final SSLSessiongetSession(byte[] sessionId) This is provided for API-compatibility only, not intended for use.final int(package private) final NativeSslSessiongetSessionFromCache(byte[] sessionId) Called for server sessions only.(package private) abstract NativeSslSessiongetSessionFromPersistentCache(byte[] sessionId) Called for server sessions only.final int(package private) abstract voidonBeforeAddSession(NativeSslSession session) Called when the given session is about to be added.(package private) abstract voidonBeforeRemoveSession(NativeSslSession session) Called when a session is about to be removed.(package private) final voidremoveSession(NativeSslSession session) Removes the given session from the cache.final voidsetSessionCacheSize(int size) final voidsetSessionTimeout(int seconds) private voidMakes 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:
getIdsin 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:
getSessionin interfaceSSLSessionContext
-
getSessionCacheSize
public final int getSessionCacheSize()- Specified by:
getSessionCacheSizein interfaceSSLSessionContext
-
getSessionTimeout
public final int getSessionTimeout()- Specified by:
getSessionTimeoutin interfaceSSLSessionContext
-
setSessionTimeout
- Specified by:
setSessionTimeoutin interfaceSSLSessionContext- Throws:
IllegalArgumentException
-
setSessionCacheSize
- Specified by:
setSessionCacheSizein 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 byServerSessionContextto -
onBeforeAddSession
Called when the given session is about to be added. Used byClientSessionContextto 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 byClientSessionContextto 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.
-