public final class ConnectionCache extends Object implements Runnable, ExceptionSource
Modifier and Type | Method and Description |
---|---|
URLConnection |
get(Object key)
Returns the URLConnection associated with the given key.
|
List<ExceptionMonitor> |
getExceptionMonitors()
Returns all ExceptionMonitors that are registered.
|
static ConnectionCache |
getInstance()
Returns the singleton instance.
|
void |
put(Object key,
URLConnection conn)
Stores a URLConnection in association with a key.
|
void |
registerExceptionMonitor(ExceptionMonitor monitor)
Register a ExceptionMonitor with the source.
|
void |
run()
When an object implementing interface
Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
void |
unregisterExceptionMonitor(ExceptionMonitor monitor)
Unregister a ExceptionMonitor with the source.
|
public static ConnectionCache getInstance()
public URLConnection get(Object key)
key
- The key that is associated to the URL.public void put(Object key, URLConnection conn)
key
- The key that is associated to the URLConnection.conn
- The URLConnection that should be stored in association with the key.public void run()
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
The general contract of the method run
is that it may
take any action whatsoever.run
in interface Runnable
Thread.run()
public void registerExceptionMonitor(ExceptionMonitor monitor) throws TooManyMonitorsException
registerExceptionMonitor
in interface ExceptionSource
monitor
- The ExceptionMonitor to be notified.TooManyMonitorsException
- If more than one monitor is registered.public void unregisterExceptionMonitor(ExceptionMonitor monitor)
unregisterExceptionMonitor
in interface ExceptionSource
monitor
- The ExceptionMonitor to be unregistered.public List<ExceptionMonitor> getExceptionMonitors()
getExceptionMonitors
in interface ExceptionSource
Copyright © 2006–2019 OPS4J - Open Participation Software for Java. All rights reserved.