|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.epl.db.ConnectionCache
public abstract class ConnectionCache
Base class for a Connection and PreparedStatement cache.
Implementations control the lifecycle via lifecycle methods, or may simple obtain new resources and close new resources every time.
This is not a pool - a cache is associated with one client class and that class is expected to use cache methods in well-defined order of get, done-with and destroy.
Constructor Summary | |
---|---|
protected |
ConnectionCache(DatabaseConnectionFactory databaseConnectionFactory,
java.lang.String sql)
Ctor. |
Method Summary | |
---|---|
protected static void |
close(Pair<java.sql.Connection,java.sql.PreparedStatement> pair)
Close resources. |
abstract void |
destroy()
Destroys cache closing all resources cached, if any. |
abstract void |
doneWith(Pair<java.sql.Connection,java.sql.PreparedStatement> pair)
Indicate to return the connection and statement pair after use. |
abstract Pair<java.sql.Connection,java.sql.PreparedStatement> |
getConnection()
Returns a cached or new connection and statement pair. |
protected Pair<java.sql.Connection,java.sql.PreparedStatement> |
makeNew()
Make a new pair of resources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ConnectionCache(DatabaseConnectionFactory databaseConnectionFactory, java.lang.String sql)
databaseConnectionFactory
- - connection factorysql
- - statement sqlMethod Detail |
---|
public abstract Pair<java.sql.Connection,java.sql.PreparedStatement> getConnection()
public abstract void doneWith(Pair<java.sql.Connection,java.sql.PreparedStatement> pair)
pair
- is the resources to returnpublic abstract void destroy()
protected static void close(Pair<java.sql.Connection,java.sql.PreparedStatement> pair)
pair
- is the resources to close.protected Pair<java.sql.Connection,java.sql.PreparedStatement> makeNew()
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |