Package org.scictrl.csshell
Class AbstractConnector.DefaultConnectionCache
java.lang.Object
org.scictrl.csshell.AbstractConnector.DefaultConnectionCache
- All Implemented Interfaces:
ConnectionCache<C>
- Enclosing class:
AbstractConnector<C extends Connection<?,
?, ?>>
Default implementation of connection cache interface. Uses weak references.
- Author:
- igor@scictrl.com
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
DefaultConnectionCache
public DefaultConnectionCache()Constructor.
-
-
Method Details
-
add
Description copied from interface:ConnectionCache
Adds connection to the cache by it's name. If any connection by same name already exists, it is released and returned.- Specified by:
add
in interfaceConnectionCache<C extends Connection<?,
?, ?>> - Parameters:
ch
- the connection to be placed in cache- Returns:
- previous connection with this name, if it was any, otherwise
null
-
remove
Description copied from interface:ConnectionCache
Removes connection from cache.- Specified by:
remove
in interfaceConnectionCache<C extends Connection<?,
?, ?>> - Parameters:
name
- the name of connection to be removed from cache- Returns:
- the removed connection, is exists, otherwise
null
-
get
Description copied from interface:ConnectionCache
Returns connection, which has provided name. Ornull
if no such connection.- Specified by:
get
in interfaceConnectionCache<C extends Connection<?,
?, ?>> - Parameters:
name
- the connection name- Returns:
- the connection, or null
-
cleanup
public void cleanup()Description copied from interface:ConnectionCache
Removes all dead references and deleted connections.- Specified by:
cleanup
in interfaceConnectionCache<C extends Connection<?,
?, ?>>
-