org.firebirdsql.pool
Class StatementHandler
java.lang.Object
|
+--org.firebirdsql.pool.StatementHandler
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
- public class StatementHandler
- extends java.lang.Object
- implements java.lang.reflect.InvocationHandler
Dynamic proxy handler that together with PooledConnectionHandler
ensure that statements will be closed before connection is returned to the
pool.
- Author:
- Roman Rokytskyy
Constructor Summary |
StatementHandler(org.firebirdsql.pool.PooledConnectionHandler connectionHandler,
java.sql.Statement wrappedObject)
Create instance of this class for the specified connection handler and |
Method Summary |
java.sql.Statement |
getProxy()
Get dynamic proxy instant wrapping the statement. |
java.sql.Statement |
getWrappedObject()
Get original statement that was wrapped. |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Invoke a specified method with the specified arguments on the specified
proxy. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StatementHandler
public StatementHandler(org.firebirdsql.pool.PooledConnectionHandler connectionHandler,
java.sql.Statement wrappedObject)
- Create instance of this class for the specified connection handler and
- Parameters:
connectionHandler
- instance of PooledConnectionHandler
that is
responsible for a connection that created a statement to wrap.wrappedObject
- instance of Statement
to wrap.
getProxy
public java.sql.Statement getProxy()
- Get dynamic proxy instant wrapping the statement.
- Returns:
- instance of
Statement
.
getWrappedObject
public java.sql.Statement getWrappedObject()
- Get original statement that was wrapped.
- Returns:
- instance of
Statement
.
invoke
public java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
- Invoke a specified method with the specified arguments on the specified
proxy. This method checks if
Statement.close()
is called
and de-registers the statement from automatic close on connection close.
- Specified by:
invoke
in interface java.lang.reflect.InvocationHandler
- Parameters:
proxy
- proxy, on which the method was called.method
- method that was invoked.args
- arguments that were passed to the method.- Returns:
- object that was returned by the method.
- Throws:
java.lang.Throwable
- throwable that was thrown during method processing.
Copyright © 2001 David Jencks and other authors. All rights reserved.