Class ServerSessionContext
- All Implemented Interfaces:
SSLSessionContext
public class ServerSessionContext extends Object
-
Constructor Summary
Constructors Constructor Description ServerSessionContext() -
Method Summary
Modifier and Type Method Description protected voidfinalize()Invoked when the garbage collector has detected that this instance is no longer reachable.Enumeration<byte[]>getIds()Returns an iterable of all session identifiers in this session context.SSLSessiongetSession(byte[] sessionId)Returns the session for the specified session identifier.intgetSessionCacheSize()Returns the size of the session cache for this session context.intgetSessionTimeout()Returns the timeout for sessions in this session context.protected voidsessionRemoved(SSLSession session)Called when a session is removed.voidsetPersistentCache(SSLServerSessionCache persistentCache)voidsetSessionCacheSize(int size)Sets the size of the session cache for this session context.voidsetSessionTimeout(int seconds)Sets the timeout for sessions in this context.protected voidtrimToSize()Makes sure cache size is < maximumSize.
-
Constructor Details
-
ServerSessionContext
public ServerSessionContext()
-
-
Method Details
-
setPersistentCache
-
sessionRemoved
Called when a session is removed. Used by ClientSessionContext to update its host-and-port based cache. -
getSession
Description copied from interface:SSLSessionContextReturns the session for the specified session identifier.- Specified by:
getSessionin interfaceSSLSessionContext- Parameters:
sessionId- the session identifier of the session to look up.- Returns:
- the session for the specified session identifier, or
nullif the specified session identifier does not refer to a session in this context.
-
getIds
Description copied from interface:SSLSessionContextReturns an iterable of all session identifiers in this session context.- Specified by:
getIdsin interfaceSSLSessionContext- Returns:
- an iterable of all session identifiers in this session context.
-
getSessionCacheSize
public final int getSessionCacheSize()Description copied from interface:SSLSessionContextReturns the size of the session cache for this session context.- Specified by:
getSessionCacheSizein interfaceSSLSessionContext- Returns:
- the size of the session cache for this session context, or
zeroif unlimited.
-
getSessionTimeout
public final int getSessionTimeout()Description copied from interface:SSLSessionContextReturns the timeout for sessions in this session context. Sessions exceeding the timeout are invalidated.- Specified by:
getSessionTimeoutin interfaceSSLSessionContext- Returns:
- the timeout in seconds, or
zeroif unlimited.
-
trimToSize
protected void trimToSize()Makes sure cache size is < maximumSize. -
setSessionTimeout
Description copied from interface:SSLSessionContextSets the timeout for sessions in this context. Sessions exceeding the timeout are invalidated.- Specified by:
setSessionTimeoutin interfaceSSLSessionContext- Parameters:
seconds- the timeout in seconds, orzeroif unlimited.- Throws:
IllegalArgumentException- ifsecondsis negative.
-
setSessionCacheSize
Description copied from interface:SSLSessionContextSets the size of the session cache for this session context.- Specified by:
setSessionCacheSizein interfaceSSLSessionContext- Parameters:
size- the size of the session cache, orzerofor unlimited cache size.- Throws:
IllegalArgumentException- ifsizeis negative.
-
finalize
Description copied from class:ObjectInvoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.Note that objects that override
finalizeare significantly more expensive than objects that don't. Finalizers may be run a long time after the object is no longer reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup. Note also that finalizers are run on a single VM-wide finalizer thread, so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary for a class that has a native peer and needs to call a native method to destroy that peer. Even then, it's better to provide an explicitclosemethod (and implementCloseable), and insist that callers manually dispose of instances. This works well for something like files, but less well for something like aBigIntegerwhere typical calling code would have to deal with lots of temporaries. Unfortunately, code that creates lots of temporaries is the worst kind of code from the point of view of the single finalizer thread.If you must use finalizers, consider at least providing your own
ReferenceQueueand having your own thread process that queue.Unlike constructors, finalizers are not automatically chained. You are responsible for calling
super.finalize()yourself.Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.
-