Package io.netty.handler.ssl
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.SSLSessionCacheSSLSessionCacheimplementation for our native SSL implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classOpenSslSessionCache.NativeSslSessionOpenSslInternalSessionimplementation which wraps the native SSL_SESSION* while in cache.
-
Field Summary
Fields Modifier and Type Field Description private static intDEFAULT_CACHE_SIZEprivate static OpenSslInternalSession[]EMPTY_SESSIONSprivate OpenSslEngineMapengineMapprivate java.util.concurrent.atomic.AtomicIntegermaximumCacheSizeprivate intsessionCounterprivate java.util.Map<OpenSslSessionId,OpenSslSessionCache.NativeSslSession>sessionsprivate java.util.concurrent.atomic.AtomicIntegersessionTimeout
-
Constructor Summary
Constructors Constructor Description OpenSslSessionCache(OpenSslEngineMap engineMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclear()Clear the cache and free all cached SSL_SESSION*.(package private) booleancontainsSessionWithId(OpenSslSessionId id)Returnstrueif there is a session for the given id in the cache.private voidexpungeInvalidSessions()(package private) java.util.List<OpenSslSessionId>getIds()Returns a snapshot of the session ids of the current valid sessions.longgetSession(long ssl, byte[] sessionId)(package private) OpenSslInternalSessiongetSession(OpenSslSessionId id)Return theOpenSslInternalSessionwhich is cached for the given id.(package private) intgetSessionCacheSize()(package private) intgetSessionTimeout()private voidnotifyRemovalAndFree(OpenSslSessionCache.NativeSslSession session)(package private) voidremoveSessionWithId(OpenSslSessionId id)Remove the session with the given id from the cachebooleansessionCreated(long ssl, long sslSession)protected booleansessionCreated(OpenSslSessionCache.NativeSslSession session)Called once a newOpenSslInternalSessionwas created.protected voidsessionRemoved(OpenSslSessionCache.NativeSslSession session)Called once anOpenSslInternalSessionwas removed from the cache.(package private) booleansetSession(long ssl, OpenSslInternalSession session, java.lang.String host, int port)(package private) voidsetSessionCacheSize(int size)(package private) voidsetSessionTimeout(int seconds)
-
-
-
Field Detail
-
EMPTY_SESSIONS
private static final OpenSslInternalSession[] EMPTY_SESSIONS
-
DEFAULT_CACHE_SIZE
private static final int DEFAULT_CACHE_SIZE
-
engineMap
private final OpenSslEngineMap engineMap
-
sessions
private final java.util.Map<OpenSslSessionId,OpenSslSessionCache.NativeSslSession> sessions
-
maximumCacheSize
private final java.util.concurrent.atomic.AtomicInteger maximumCacheSize
-
sessionTimeout
private final java.util.concurrent.atomic.AtomicInteger sessionTimeout
-
sessionCounter
private int sessionCounter
-
-
Constructor Detail
-
OpenSslSessionCache
OpenSslSessionCache(OpenSslEngineMap engineMap)
-
-
Method Detail
-
setSessionTimeout
final void setSessionTimeout(int seconds)
-
getSessionTimeout
final int getSessionTimeout()
-
sessionCreated
protected boolean sessionCreated(OpenSslSessionCache.NativeSslSession session)
Called once a newOpenSslInternalSessionwas created.- Parameters:
session- the new session.- Returns:
trueif the session should be cached,falseotherwise.
-
sessionRemoved
protected void sessionRemoved(OpenSslSessionCache.NativeSslSession session)
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
boolean setSession(long ssl, OpenSslInternalSession session, java.lang.String host, int port)
-
removeSessionWithId
final void removeSessionWithId(OpenSslSessionId id)
Remove the session with the given id from the cache
-
containsSessionWithId
final boolean containsSessionWithId(OpenSslSessionId id)
Returnstrueif there is a session for the given id in the cache.
-
notifyRemovalAndFree
private void notifyRemovalAndFree(OpenSslSessionCache.NativeSslSession session)
-
getSession
final OpenSslInternalSession getSession(OpenSslSessionId id)
Return theOpenSslInternalSessionwhich is cached for the given id.
-
getIds
final java.util.List<OpenSslSessionId> 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*.
-
-