Package org.conscrypt
Class ClientSessionContext
java.lang.Object
org.conscrypt.AbstractSessionContext
org.conscrypt.ClientSessionContext
- All Implemented Interfaces:
SSLSessionContext
Caches client sessions. Indexes by host and port. Users are typically
looking to reuse any session for a given host and port.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SSLClientSessionCacheprivate final Map<ClientSessionContext.HostAndPort, List<NativeSslSession>> Sessions indexed by host and port.Fields inherited from class org.conscrypt.AbstractSessionContext
sslCtxNativePointer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) NativeSslSessiongetCachedSession(String hostName, int port, SSLParametersImpl sslParameters) Gets the suitable session reference from the session cache container.private NativeSslSessiongetSession(String host, int port) Finds a cached session for the given host name and port.(package private) NativeSslSessiongetSessionFromPersistentCache(byte[] sessionId) Called for server sessions only.(package private) voidonBeforeAddSession(NativeSslSession session) Called when the given session is about to be added.(package private) voidonBeforeRemoveSession(NativeSslSession session) Called when a session is about to be removed.private voidputSession(ClientSessionContext.HostAndPort key, NativeSslSession session) private voidremoveSession(ClientSessionContext.HostAndPort key, NativeSslSession session) voidsetPersistentCache(SSLClientSessionCache persistentCache) Applications should not use this method.(package private) intsize()Methods inherited from class org.conscrypt.AbstractSessionContext
cacheSession, finalize, getIds, getSession, getSessionCacheSize, getSessionFromCache, getSessionTimeout, removeSession, setSessionCacheSize, setSessionTimeout
-
Field Details
-
sessionsByHostAndPort
Sessions indexed by host and port. Protect from concurrent access by holding a lock on sessionsByHostAndPort. Invariant: Each list includes either exactly one multi-use session or one or more single-use sessions. The types of sessions are never mixed, and adding a session of one kind will remove all sessions of the other kind. -
persistentCache
-
-
Constructor Details
-
ClientSessionContext
ClientSessionContext()
-
-
Method Details
-
setPersistentCache
Applications should not use this method. Instead useConscrypt.setClientSessionCache(SSLContext, SSLClientSessionCache). -
getCachedSession
Gets the suitable session reference from the session cache container. -
size
int size() -
getSession
Finds a cached session for the given host name and port.- Parameters:
host- of serverport- of server- Returns:
- cached session or null if none found
-
putSession
-
removeSession
-
onBeforeAddSession
Description copied from class:AbstractSessionContextCalled 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.
- Specified by:
onBeforeAddSessionin classAbstractSessionContext
-
onBeforeRemoveSession
Description copied from class:AbstractSessionContextCalled 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.
- Specified by:
onBeforeRemoveSessionin classAbstractSessionContext
-
getSessionFromPersistentCache
Description copied from class:AbstractSessionContextCalled for server sessions only. Retrieves the session by ID from the persistent cache.Visible for extension only, not intended to be called directly.
- Specified by:
getSessionFromPersistentCachein classAbstractSessionContext
-