Top Description Inners Fields Constructors Methods
org.apache.tomcat.jdbc.pool.interceptor

public Class StatementFinalizer

extends AbstractCreateStatementInterceptor
Class Inheritance
Imports
java.lang.ref.WeakReference, java.lang.reflect.Method, java.sql.Statement, java.util.LinkedList, .List, .Map, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.jdbc.pool.ConnectionPool, .PoolProperties, .PooledConnection

Keeps track of statements associated with a connection and invokes close upon java.sql.Connection#close() Useful for applications that don't close the associated statements after being done with a connection.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
private static final Log
private boolean
protected List<StatementFinalizer.StatementEntry>
Inherited from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor:
constructorsCREATE_STATEMENTCREATE_STATEMENT_IDXEXECUTEEXECUTE_BATCHEXECUTE_QUERYEXECUTE_TYPESEXECUTE_UPDATEPREPARE_CALLPREPARE_CALL_IDXPREPARE_STATEMENTPREPARE_STATEMENT_IDXSTATEMENT_TYPE_COUNTSTATEMENT_TYPES

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public Object
createStatement(Object
the actual proxy object
proxy
,
Method
the method that was called. It will be one of the methods defined in STATEMENT_TYPES
method
,
Object[]
the arguments to the method
args
,
Object
the statement that the underlying connection created
statement
,
long
Elapsed time
time
)

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.createStatement.

This method will be invoked after a successful statement creation.

public void
reset(ConnectionPool
- the connection pool owning the connection
parent
,
PooledConnection
- the pooled connection
con
)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.reset.

no-op for this interceptor.

public void
setProperties(Map<String, PoolProperties.InterceptorProperty>
The properties
properties
)

Overrides org.apache.tomcat.jdbc.pool.JdbcInterceptor.setProperties.

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

Inherited from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor:
getConstructorinvokeisExecuteisStatementprocess

Field Detail

logback to summary
private static final Log log
logCreationStackback to summary
private boolean logCreationStack
statementsback to summary
protected List<StatementFinalizer.StatementEntry> statements

Constructor Detail

StatementFinalizerback to summary
public StatementFinalizer()

Method Detail

closeInvokedback to summary
public void closeInvoked()

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.closeInvoked.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.closeInvoked.

Method invoked when the operation java.sql.Connection#close() is invoked.

Annotations
@SuppressWarnings:null
@Override
createStatementback to summary
public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time)

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.createStatement.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.createStatement.

This method will be invoked after a successful statement creation. This method can choose to return a wrapper around the statement or return the statement itself. If this method returns a wrapper then it should return a wrapper object that implements one of the following interfaces. java.sql.Statement, java.sql.PreparedStatement or java.sql.CallableStatement

Parameters
proxy:Object

the actual proxy object

method:Method

the method that was called. It will be one of the methods defined in STATEMENT_TYPES

args:Object[]

the arguments to the method

statement:Object

the statement that the underlying connection created

time:long

Elapsed time

Returns:Object

a java.sql.Statement object

Annotations
@Override
resetback to summary
public void reset(ConnectionPool parent, PooledConnection con)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.reset.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.reset.

no-op for this interceptor. no state is stored.

Parameters
parent:ConnectionPool

Doc from org.apache.tomcat.jdbc.pool.JdbcInterceptor.reset.

- the connection pool owning the connection

con:PooledConnection

Doc from org.apache.tomcat.jdbc.pool.JdbcInterceptor.reset.

- the pooled connection

Annotations
@Override
setPropertiesback to summary
public void setProperties(Map<String, PoolProperties.InterceptorProperty> properties)

Overrides org.apache.tomcat.jdbc.pool.JdbcInterceptor.setProperties.

Doc from org.apache.tomcat.jdbc.pool.JdbcInterceptor.setProperties.

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

Parameters
properties:Map<String, PoolProperties.InterceptorProperty>

The properties

Annotations
@Override
org.apache.tomcat.jdbc.pool.interceptor back to summary

protected Class StatementFinalizer.StatementEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer.StatementEntry

Field Summary

Modifier and TypeField and Description
private Throwable
private WeakReference<Statement>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Throwable
public Statement
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allocationStackback to summary
private Throwable allocationStack
statementback to summary
private WeakReference<Statement> statement

Constructor Detail

StatementEntryback to summary
public StatementEntry(Statement statement)

Method Detail

getAllocationStackback to summary
public Throwable getAllocationStack()
getStatementback to summary
public Statement getStatement()