home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / net / www / http / KeepAliveCache.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-08  |  1.8 KB  |  36 lines

  1. package sun.net.www.http;
  2.  
  3. import java.net.URL;
  4. import java.util.Hashtable;
  5.  
  6. public class KeepAliveCache extends Hashtable {
  7.    static int MAXCONNS = Integer.getInteger("http.maxConnections", 2);
  8.    static final int LIFETIME = 5000;
  9.    static final int PROXY_LIFETIME = 10000;
  10.  
  11.    public synchronized void put(URL var1, HttpClient var2) {
  12.       KeepAliveKey var3 = new KeepAliveKey(var1);
  13.       ClientVector var4 = (ClientVector)super.get(var3);
  14.       if (var4 == null) {
  15.          var4 = new ClientVector(this, var3, var2.usingProxy ? 10000 : 5000);
  16.          var4.put(var2);
  17.          super.put(var3, var4);
  18.          Thread var5 = new Thread(var4, "Keep-Alive-Timer:" + var1.getHost());
  19.          var5.setPriority(8);
  20.          var5.start();
  21.       } else {
  22.          var4.put(var2);
  23.       }
  24.    }
  25.  
  26.    synchronized void removeVector(KeepAliveKey var1) {
  27.       super.remove(var1);
  28.    }
  29.  
  30.    public Object get(URL var1) {
  31.       KeepAliveKey var2 = new KeepAliveKey(var1);
  32.       ClientVector var3 = (ClientVector)super.get(var2);
  33.       return var3 == null ? null : var3.get();
  34.    }
  35. }
  36.