org.apache.tomcat.jdbc.pool.interceptor
Class StatementCache
java.lang.Object
org.apache.tomcat.jdbc.pool.JdbcInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor
org.apache.tomcat.jdbc.pool.interceptor.StatementCache
- All Implemented Interfaces:
- InvocationHandler
public class StatementCache
- extends StatementDecoratorInterceptor
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor |
CREATE_STATEMENT, CREATE_STATEMENT_IDX, EXECUTE, EXECUTE_BATCH, EXECUTE_QUERY, EXECUTE_TYPES, EXECUTE_UPDATE, PREPARE_CALL, PREPARE_CALL_IDX, PREPARE_STATEMENT, PREPARE_STATEMENT_IDX, STATEMENT_TYPE_COUNT, STATEMENT_TYPES |
Method Summary |
boolean |
cacheStatement(StatementCache.CachedStatement proxy)
|
void |
closeStatement(StatementCache.CachedStatement st)
|
protected Object |
createDecorator(Object proxy,
Method method,
Object[] args,
Object statement,
Constructor<?> constructor,
String sql)
|
void |
disconnected(ConnectionPool parent,
PooledConnection con,
boolean finalizing)
Called when Connection.close() is called on the underlying connection. |
AtomicInteger |
getCacheSize()
|
int |
getMaxCacheSize()
|
String[] |
getTypes()
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Gets invoked each time an operation on Connection is invoked. |
boolean |
isCacheCallable()
|
StatementCache.CachedStatement |
isCached(String sql)
|
boolean |
isCachePrepared()
|
void |
poolClosed(ConnectionPool pool)
This method is invoked by a connection pool when the pool is closed. |
void |
poolStarted(ConnectionPool pool)
This method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested. |
boolean |
removeStatement(StatementCache.CachedStatement proxy)
|
void |
reset(ConnectionPool parent,
PooledConnection con)
no-op for this interceptor. no state is stored. |
void |
setProperties(Map<String,PoolProperties.InterceptorProperty> properties)
Called during the creation of an interceptor
The properties can be set during the configuration of an interceptor
Override this method to perform type casts between string values and object properties |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALL_TYPES
protected static final String[] ALL_TYPES
CALLABLE_TYPE
protected static final String[] CALLABLE_TYPE
PREPARED_TYPE
protected static final String[] PREPARED_TYPE
NO_TYPE
protected static final String[] NO_TYPE
STATEMENT_CACHE_ATTR
protected static final String STATEMENT_CACHE_ATTR
StatementCache
public StatementCache()
isCachePrepared
public boolean isCachePrepared()
isCacheCallable
public boolean isCacheCallable()
getMaxCacheSize
public int getMaxCacheSize()
getTypes
public String[] getTypes()
getCacheSize
public AtomicInteger getCacheSize()
setProperties
public void setProperties(Map<String,PoolProperties.InterceptorProperty> properties)
- Description copied from class:
JdbcInterceptor
- Called during the creation of an interceptor
The properties can be set during the configuration of an interceptor
Override this method to perform type casts between string values and object properties
- Overrides:
setProperties
in class JdbcInterceptor
poolStarted
public void poolStarted(ConnectionPool pool)
- Description copied from class:
JdbcInterceptor
- This method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested.
Interceptor classes can override this method if they keep static
variables or other tracking means around.
This method is only invoked on a single instance of the interceptor, and not on every instance created.
- Overrides:
poolStarted
in class JdbcInterceptor
- Parameters:
pool
- - the pool that is being closed.
poolClosed
public void poolClosed(ConnectionPool pool)
- Description copied from class:
JdbcInterceptor
- This method is invoked by a connection pool when the pool is closed.
Interceptor classes can override this method if they keep static
variables or other tracking means around.
This method is only invoked on a single instance of the interceptor, and not on every instance created.
- Overrides:
poolClosed
in class JdbcInterceptor
- Parameters:
pool
- - the pool that is being closed.
reset
public void reset(ConnectionPool parent,
PooledConnection con)
- Description copied from class:
AbstractCreateStatementInterceptor
- no-op for this interceptor. no state is stored.
- Overrides:
reset
in class AbstractCreateStatementInterceptor
- Parameters:
parent
- - the connection pool owning the connectioncon
- - the pooled connection
disconnected
public void disconnected(ConnectionPool parent,
PooledConnection con,
boolean finalizing)
- Description copied from class:
JdbcInterceptor
- Called when
Connection.close()
is called on the underlying connection.
This is to notify the interceptors, that the physical connection has been released.
Implementation of this method should be thought through with care, as no actions should trigger an exception.
- Overrides:
disconnected
in class JdbcInterceptor
- Parameters:
parent
- - the connection pool that this connection belongs tocon
- - the pooled connection that holds this connectionfinalizing
- - if this connection is finalizing. True means that the pooled connection will not reconnect the underlying connection
closeStatement
public void closeStatement(StatementCache.CachedStatement st)
createDecorator
protected Object createDecorator(Object proxy,
Method method,
Object[] args,
Object statement,
Constructor<?> constructor,
String sql)
throws InstantiationException,
IllegalAccessException,
InvocationTargetException
- Overrides:
createDecorator
in class StatementDecoratorInterceptor
- Throws:
InstantiationException
IllegalAccessException
InvocationTargetException
invoke
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
- Description copied from class:
AbstractCreateStatementInterceptor
- Gets invoked each time an operation on
Connection
is invoked.
- Specified by:
invoke
in interface InvocationHandler
- Overrides:
invoke
in class AbstractCreateStatementInterceptor
- Throws:
Throwable
isCached
public StatementCache.CachedStatement isCached(String sql)
cacheStatement
public boolean cacheStatement(StatementCache.CachedStatement proxy)
removeStatement
public boolean removeStatement(StatementCache.CachedStatement proxy)
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.