Class OpenSslSessionCache
java.lang.Object
io.netty.handler.ssl.OpenSslSessionCache
- All Implemented Interfaces:
io.netty.internal.tcnative.SSLSessionCache
- Direct Known Subclasses:
OpenSslClientSessionCache
class OpenSslSessionCache
extends java.lang.Object
implements io.netty.internal.tcnative.SSLSessionCache
SSLSessionCache implementation for our native SSL implementation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classOpenSslInternalSessionimplementation which wraps the native SSL_SESSION* while in cache. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final OpenSslInternalSession[]private final OpenSslEngineMapprivate final java.util.concurrent.atomic.AtomicIntegerprivate intprivate final java.util.Map<OpenSslSessionId, OpenSslSessionCache.NativeSslSession> private final java.util.concurrent.atomic.AtomicInteger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidclear()Clear the cache and free all cached SSL_SESSION*.(package private) final booleanReturnstrueif there is a session for the given id in the cache.private void(package private) final java.util.List<OpenSslSessionId> getIds()Returns a snapshot of the session ids of the current valid sessions.final longgetSession(long ssl, byte[] sessionId) (package private) final OpenSslInternalSessionReturn theOpenSslInternalSessionwhich is cached for the given id.(package private) final int(package private) final intprivate void(package private) final voidRemove the session with the given id from the cachebooleansessionCreated(long ssl, long sslSession) protected booleanCalled once a newOpenSslInternalSessionwas created.protected voidCalled once anOpenSslInternalSessionwas removed from the cache.(package private) booleansetSession(long ssl, OpenSslInternalSession session, java.lang.String host, int port) (package private) final voidsetSessionCacheSize(int size) (package private) final voidsetSessionTimeout(int seconds) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
EMPTY_SESSIONS
-
DEFAULT_CACHE_SIZE
private static final int DEFAULT_CACHE_SIZE -
engines
-
sessions
-
maximumCacheSize
private final java.util.concurrent.atomic.AtomicInteger maximumCacheSize -
sessionTimeout
private final java.util.concurrent.atomic.AtomicInteger sessionTimeout -
sessionCounter
private int sessionCounter
-
-
Constructor Details
-
OpenSslSessionCache
OpenSslSessionCache(OpenSslEngineMap engines)
-
-
Method Details
-
setSessionTimeout
final void setSessionTimeout(int seconds) -
getSessionTimeout
final int getSessionTimeout() -
sessionCreated
Called once a newOpenSslInternalSessionwas created.- Parameters:
session- the new session.- Returns:
trueif the session should be cached,falseotherwise.
-
sessionRemoved
Called once anOpenSslInternalSessionwas removed from the cache.- Parameters:
session- the session to remove.
-
setSessionCacheSize
final void setSessionCacheSize(int size) -
getSessionCacheSize
final int getSessionCacheSize() -
expungeInvalidSessions
private void expungeInvalidSessions() -
sessionCreated
public boolean sessionCreated(long ssl, long sslSession) - Specified by:
sessionCreatedin interfaceio.netty.internal.tcnative.SSLSessionCache
-
getSession
public final long getSession(long ssl, byte[] sessionId) - Specified by:
getSessionin interfaceio.netty.internal.tcnative.SSLSessionCache
-
setSession
-
removeSessionWithId
Remove the session with the given id from the cache -
containsSessionWithId
Returnstrueif there is a session for the given id in the cache. -
notifyRemovalAndFree
-
getSession
Return theOpenSslInternalSessionwhich is cached for the given id. -
getIds
Returns a snapshot of the session ids of the current valid sessions. -
clear
void clear()Clear the cache and free all cached SSL_SESSION*.
-