--- a/jdk/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java Thu Oct 13 13:53:13 2011 -0400
+++ b/jdk/src/share/classes/sun/security/ssl/SSLSessionContextImpl.java Tue Oct 18 10:12:14 2011 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,11 +43,14 @@
import javax.net.ssl.SSLSession;
import sun.security.util.Cache;
+import sun.security.util.Cache.CacheVisitor;
final class SSLSessionContextImpl implements SSLSessionContext {
- private Cache sessionCache; // session cache, session id as key
- private Cache sessionHostPortCache; // session cache, "host:port" as key
+ private Cache<SessionId, SSLSessionImpl> sessionCache;
+ // session cache, session id as key
+ private Cache<String, SSLSessionImpl> sessionHostPortCache;
+ // session cache, "host:port" as key
private int cacheLimit; // the max cache size
private int timeout; // timeout in seconds
@@ -71,8 +74,7 @@
throw new NullPointerException("session id cannot be null");
}
- SSLSessionImpl sess =
- (SSLSessionImpl)sessionCache.get(new SessionId(sessionId));
+ SSLSessionImpl sess = sessionCache.get(new SessionId(sessionId));
if (!isTimedout(sess)) {
return sess;
}
@@ -157,8 +159,7 @@
return null;
}
- SSLSessionImpl sess =
- (SSLSessionImpl)sessionHostPortCache.get(getKey(hostname, port));
+ SSLSessionImpl sess = sessionHostPortCache.get(getKey(hostname, port));
if (!isTimedout(sess)) {
return sess;
}
@@ -193,7 +194,7 @@
// package-private method, remove a cached SSLSession
void remove(SessionId key) {
- SSLSessionImpl s = (SSLSessionImpl)sessionCache.get(key);
+ SSLSessionImpl s = sessionCache.get(key);
if (s != null) {
sessionCache.remove(key);
sessionHostPortCache.remove(
@@ -233,17 +234,17 @@
}
final class SessionCacheVisitor
- implements sun.security.util.Cache.CacheVisitor {
+ implements Cache.CacheVisitor<SessionId, SSLSessionImpl> {
Vector<byte[]> ids = null;
- // public void visit(java.util.Map<Object, Object> map) {}
- public void visit(java.util.Map<Object, Object> map) {
- ids = new Vector<byte[]>(map.size());
+ // public void visit(java.util.Map<K,V> map) {}
+ public void visit(java.util.Map<SessionId, SSLSessionImpl> map) {
+ ids = new Vector<>(map.size());
- for (Object key : map.keySet()) {
- SSLSessionImpl value = (SSLSessionImpl)map.get(key);
+ for (SessionId key : map.keySet()) {
+ SSLSessionImpl value = map.get(key);
if (!isTimedout(value)) {
- ids.addElement(((SessionId)key).getId());
+ ids.addElement(key.getId());
}
}
}