Top Description Inners Fields Constructors Methods
sun.net.www.http

public Class KeepAliveCache

Additional top-level classes in compilation unit: KeepAliveKey, KeepAliveEntry.

extends HashMap<KeepAliveKey, KeepAliveCache.ClientVector>
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Imports
java.io.IOException, .NotSerializableException, .ObjectInputStream, .ObjectOutputStream, java.net.URL, java.security.AccessController, .PrivilegedAction, java.util.ArrayDeque, .ArrayList, .HashMap, .List, java.util.concurrent.locks.ReentrantLock, jdk.internal.misc.InnocuousThread, sun.security.action.GetIntegerAction, sun.net.www.protocol.http.HttpURLConnection, sun.util.logging.PlatformLogger

A class that implements a cache of idle Http connections for keep-alive
Authors
Stephen R. Pietrowicz (NCSA), Dave Brown

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private final ReentrantLock
private static final String
private Thread
pack-priv static final int
pack-priv static final PlatformLogger
pack-priv static final int
pack-priv static int
private static final long
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
KeepAliveCache()

Constructor

Method Summary

Modifier and TypeMethod and Description
public HttpClient
get(URL url, Object obj)

Check to see if this URL has a cached HttpClient

pack-priv static int
private static int
getUserKeepAlive(boolean isProxy)

pack-priv static int
public void
put(final URL
The URL contains info about the host and port
url
,
Object obj, HttpClient
The HttpClient to be cached
http
)

Register this URL and HttpClient (that supports keep-alive) with the cache

private void
readObject(ObjectInputStream
the stream
stream
)

Hides java.util.HashMap.readObject.

Reconstitutes this map from a stream (that is, deserializes it).

private void
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

private void
writeObject(ObjectOutputStream
the stream
stream
)

Hides java.util.HashMap.writeObject.

Saves this map to a stream (that is, serializes it).

Inherited from java.util.HashMap:
clearclonecomputecomputeIfAbsentcomputeIfPresentcontainsKeycontainsValueentrySetforEachgetgetOrDefaultisEmptykeySetmergenewHashMapputputAllputIfAbsentremoveremovereplacereplacereplaceAllsizevalues

Field Detail

cacheLockback to summary
private final ReentrantLock cacheLock
keepAlivePropback to summary
private static final String keepAliveProp
keepAliveTimerback to summary
private Thread keepAliveTimer
Annotations
@SuppressWarnings:serial
LIFETIMEback to summary
pack-priv static final int LIFETIME
loggerback to summary
pack-priv static final PlatformLogger logger
MAX_CONNECTIONSback to summary
pack-priv static final int MAX_CONNECTIONS
resultback to summary
pack-priv static int result
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.HashMap.serialVersionUID.

Annotations
@Serial
userKeepAliveProxyback to summary
private static final int userKeepAliveProxy
userKeepAliveServerback to summary
private static final int userKeepAliveServer

Constructor Detail

KeepAliveCacheback to summary
public KeepAliveCache()

Constructor

Method Detail

getback to summary
public HttpClient get(URL url, Object obj)

Check to see if this URL has a cached HttpClient

getMaxConnectionsback to summary
pack-priv static int getMaxConnections()
Annotations
@SuppressWarnings:removal
getUserKeepAliveback to summary
private static int getUserKeepAlive(boolean isProxy)
getUserKeepAliveSecondsback to summary
pack-priv static int getUserKeepAliveSeconds(String type)
Annotations
@SuppressWarnings:removal
putback to summary
public void put(final URL url, Object obj, HttpClient http)

Register this URL and HttpClient (that supports keep-alive) with the cache

Parameters
url:URL

The URL contains info about the host and port

http:HttpClient

The HttpClient to be cached

Annotations
@SuppressWarnings:removal
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Hides java.util.HashMap.readObject.

Doc from java.util.HashMap.readObject.

Reconstitutes this map from a stream (that is, deserializes it).

Parameters
stream:ObjectInputStream

the stream

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if the class of a serialized object could not be found
removeVectorback to summary
private void removeVector(KeepAliveKey k)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
writeObjectback to summary
private void writeObject(ObjectOutputStream stream) throws IOException

Hides java.util.HashMap.writeObject.

Doc from java.util.HashMap.writeObject.

Saves this map to a stream (that is, serializes it).

Parameters
stream:ObjectOutputStream

the stream

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
sun.net.www.http back to summary

pack-priv Class KeepAliveCache.ClientVector

extends ArrayDeque<KeepAliveEntry>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
ClientVector(int nap)

Method Summary

Modifier and TypeMethod and Description
pack-priv HttpClient
get()

pack-priv HttpClient
private void
readObject(ObjectInputStream
the stream
stream
)

Hides java.util.ArrayDeque.readObject.

Reconstitutes this deque from a stream (that is, deserializes it).

private void
writeObject(ObjectOutputStream
the stream
stream
)

Hides java.util.ArrayDeque.writeObject.

Saves this deque to a stream (that is, serializes it).

Inherited from java.util.ArrayDeque:
addaddAlladdFirstaddLastclearclonecontainsdescendingIteratorelementforEachgetFirstgetLastisEmptyiteratorofferofferFirstofferLastpeekpeekFirstpeekLastpollpollFirstpollLastpoppushremoveremoveremoveAllremoveFirstremoveFirstOccurrenceremoveIfremoveLastremoveLastOccurrenceretainAllsizespliteratortoArraytoArray

Field Detail

napback to summary
pack-priv int nap
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.ArrayDeque.serialVersionUID.

Annotations
@Serial

Constructor Detail

ClientVectorback to summary
pack-priv ClientVector(int nap)

Method Detail

getback to summary
pack-priv HttpClient get()
putback to summary
pack-priv HttpClient put(HttpClient h)
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Hides java.util.ArrayDeque.readObject.

Doc from java.util.ArrayDeque.readObject.

Reconstitutes this deque from a stream (that is, deserializes it).

Parameters
stream:ObjectInputStream

the stream

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if the class of a serialized object could not be found
writeObjectback to summary
private void writeObject(ObjectOutputStream stream) throws IOException

Hides java.util.ArrayDeque.writeObject.

Doc from java.util.ArrayDeque.writeObject.

Saves this deque to a stream (that is, serializes it).

Parameters
stream:ObjectOutputStream

the stream

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs