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
Constructors -
Method Summary
-
Constructor Details
-
DefaultConnectionCache
public DefaultConnectionCache()Constructor.
-
-
Method Details
-
add
Description copied from interface:ConnectionCacheAdds connection to the cache by it's name. If any connection by same name already exists, it is released and returned.- Specified by:
addin 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:ConnectionCacheRemoves connection from cache.- Specified by:
removein 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:ConnectionCacheReturns connection, which has provided name. Ornullif no such connection.- Specified by:
getin interfaceConnectionCache<C extends Connection<?,?, ?>> - Parameters:
name- the connection name- Returns:
- the connection, or null
-
cleanup
public void cleanup()Description copied from interface:ConnectionCacheRemoves all dead references and deleted connections.- Specified by:
cleanupin interfaceConnectionCache<C extends Connection<?,?, ?>>
-