|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jolbox.bonecp.AbstractConnectionStrategy
com.jolbox.bonecp.CachedConnectionStrategy
public class CachedConnectionStrategy
A connection strategy that is optimized to store/retrieve the connection inside a thread local variable. This makes getting a connection in a managed thread environment such as Tomcat very fast but has the limitation that it only works if # of threads <= # of connections. Should it detect that this isn't the case anymore, this class will flip back permanently to the configured fallback strategy (i.e. default strategy) and makes sure that currently assigned and unused connections are taken back.
| Field Summary |
|---|
| Fields inherited from class com.jolbox.bonecp.AbstractConnectionStrategy |
|---|
pool, terminationLock |
| Method Summary | |
|---|---|
protected Connection |
getConnectionInternal()
Actual call that returns a connection |
static ConnectionStrategy |
getInstance(BoneCP pool,
ConnectionStrategy fallbackStrategy)
Singleton pattern. |
ConnectionHandle |
pollConnection()
Obtains a connection using the configured strategy without blocking. |
void |
terminateAllConnections()
Destroys all connections using this strategy. |
| Methods inherited from class com.jolbox.bonecp.AbstractConnectionStrategy |
|---|
getConnection, postConnection, preConnection |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static ConnectionStrategy getInstance(BoneCP pool,
ConnectionStrategy fallbackStrategy)
pool - fallbackStrategy -
protected Connection getConnectionInternal()
throws SQLException
AbstractConnectionStrategy
getConnectionInternal in class AbstractConnectionStrategySQLExceptionpublic ConnectionHandle pollConnection()
ConnectionStrategy
pollConnection in interface ConnectionStrategypollConnection in class AbstractConnectionStrategypublic void terminateAllConnections()
ConnectionStrategy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||