Methods Summary |
---|
public javax.net.ssl.SSLSession | getSession(byte[] sessionId)
ByteArray key = new ByteArray(sessionId);
synchronized (sessions) {
SSLSession session = sessions.get(key);
if (session != null) {
return session;
}
}
// Check persistent cache.
if (persistentCache != null) {
byte[] data = persistentCache.getSessionData(sessionId);
if (data != null) {
SSLSession session = toSession(data, null, -1);
if (session != null) {
synchronized (sessions) {
sessions.put(key, session);
}
return session;
}
}
}
return null;
|
void | putSession(javax.net.ssl.SSLSession session)
ByteArray key = new ByteArray(session.getId());
synchronized (sessions) {
sessions.put(key, session);
}
// TODO: In background thread.
if (persistentCache != null) {
byte[] data = toBytes(session);
if (data != null) {
persistentCache.putSessionData(session, data);
}
}
|
java.util.Iterator | sessionIterator()
synchronized (sessions) {
SSLSession[] array = sessions.values().toArray(
new SSLSession[sessions.size()]);
return Arrays.asList(array).iterator();
}
|
public void | setSessionTimeout(int seconds)
if (seconds < 0) {
throw new IllegalArgumentException("seconds < 0");
}
timeout = seconds;
|
void | trimToSize()
synchronized (sessions) {
int size = sessions.size();
if (size > maximumSize) {
int removals = size - maximumSize;
Iterator<SSLSession> i = sessions.values().iterator();
do {
i.next();
i.remove();
} while (--removals > 0);
}
}
|