home *** CD-ROM | disk | FTP | other *** search
- package sun.net.www.http;
-
- import java.io.IOException;
- import java.io.NotSerializableException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.net.URL;
- import java.security.AccessController;
- import java.util.Hashtable;
- import sun.security.action.GetIntegerAction;
-
- public class KeepAliveCache extends Hashtable {
- static final int LIFETIME = 5000;
- static final int PROXY_LIFETIME = 10000;
-
- static int getMaxConnections() {
- int var0 = (Integer)AccessController.doPrivileged(new GetIntegerAction("http.maxConnections", 2));
- return var0 <= 0 ? 2 : var0;
- }
-
- public synchronized void put(URL var1, HttpClient var2) {
- KeepAliveKey var3 = new KeepAliveKey(var1);
- ClientVector var4 = (ClientVector)super.get(var3);
- if (var4 == null) {
- var4 = new ClientVector(this, var3, var2.usingProxy ? 10000 : 5000);
- var4.put(var2);
- super.put(var3, var4);
- AccessController.doPrivileged(new 1(this, var4, var1));
- } else {
- var4.put(var2);
- }
-
- }
-
- synchronized void removeVector(KeepAliveKey var1) {
- super.remove(var1);
- }
-
- public Object get(URL var1) {
- KeepAliveKey var2 = new KeepAliveKey(var1);
- ClientVector var3 = (ClientVector)super.get(var2);
- return var3 == null ? null : var3.get();
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException {
- throw new NotSerializableException();
- }
-
- private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
- throw new NotSerializableException();
- }
- }
-