D
- S
- public abstract class AbstractStatementInvocationHandler<D,S extends java.sql.Statement> extends AbstractChildInvocationHandler<D,java.sql.Connection,S>
AbstractInvocationHandler.SimpleInvoker
Modifier and Type | Field and Description |
---|---|
protected FileSupport |
fileSupport |
protected TransactionContext<D> |
transactionContext |
cluster, logger
Modifier | Constructor and Description |
---|---|
protected |
AbstractStatementInvocationHandler(java.sql.Connection connection,
SQLProxy<D,java.sql.Connection> proxy,
Invoker<D,java.sql.Connection,S> invoker,
java.lang.Class<S> statementClass,
java.util.Map<Database<D>,S> statementMap,
TransactionContext<D> transactionContext,
FileSupport fileSupport) |
Modifier and Type | Method and Description |
---|---|
protected void |
close(java.sql.Connection connection,
S statement) |
protected java.util.List<java.util.concurrent.locks.Lock> |
extractLocks(java.lang.String sql) |
protected DatabaseProperties |
getDatabaseProperties() |
protected InvocationStrategy<D,S,?> |
getInvocationStrategy(S statement,
java.lang.reflect.Method method,
java.lang.Object[] parameters)
Returns the appropriate
InvocationStrategy for the specified method. |
<R> java.util.SortedMap<Database<D>,R> |
handlePartialFailure(java.util.SortedMap<Database<D>,R> resultMap,
java.util.SortedMap<Database<D>,java.lang.Exception> exceptionMap) |
protected boolean |
isBatchMethod(java.lang.reflect.Method method) |
protected boolean |
isEndBatchMethod(java.lang.reflect.Method method) |
protected boolean |
isRecordable(java.lang.reflect.Method method) |
protected boolean |
isSelectForUpdate(java.lang.String sql) |
protected boolean |
isSQLMethod(java.lang.reflect.Method method)
Indicates whether or not the specified method accepts a SQL string as its first parameter.
|
protected void |
postInvoke(S statement,
java.lang.reflect.Method method,
java.lang.Object[] parameters)
Called after method is invoked.
|
protected void |
record(Invoker<D,S,?> invoker,
java.lang.reflect.Method method,
java.lang.Object[] parameters) |
protected void |
replay(Database<D> database,
S statement) |
close, createObject, getParent, getParentProxy, getRoot
addChild, detectClusterPanic, entries, entry, getDatabaseCluster, getInvoker, getObject, handleFailure, handleFailures, invoke, removeChild, removeChildren, retain
protected TransactionContext<D> transactionContext
protected FileSupport fileSupport
protected AbstractStatementInvocationHandler(java.sql.Connection connection, SQLProxy<D,java.sql.Connection> proxy, Invoker<D,java.sql.Connection,S> invoker, java.lang.Class<S> statementClass, java.util.Map<Database<D>,S> statementMap, TransactionContext<D> transactionContext, FileSupport fileSupport) throws java.lang.Exception
connection
- the parent connection of this statementproxy
- the parent invocation handlerinvoker
- the invoker that created this statementstatementClass
- statementMap
- a map of database to underlying statementtransactionContext
- fileSupport
- support object for streamsjava.lang.Exception
protected InvocationStrategy<D,S,?> getInvocationStrategy(S statement, java.lang.reflect.Method method, java.lang.Object[] parameters) throws java.lang.Exception
AbstractInvocationHandler
InvocationStrategy
for the specified method.
This implementation detects Wrapper
methods; and Object.equals(java.lang.Object)
, Object.hashCode()
, and Object.toString()
.
Default invocation strategy is DatabaseWriteInvocationStrategy
.getInvocationStrategy
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
statement
- the proxied objectmethod
- the method to invokeparameters
- the method invocation parametersjava.lang.Exception
AbstractInvocationHandler.getInvocationStrategy(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
protected boolean isSQLMethod(java.lang.reflect.Method method)
AbstractInvocationHandler
isSQLMethod
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
method
- a methodAbstractInvocationHandler.isSQLMethod(java.lang.reflect.Method)
protected void postInvoke(S statement, java.lang.reflect.Method method, java.lang.Object[] parameters)
AbstractInvocationHandler
postInvoke
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
statement
- the proxied objectmethod
- the method that was just invokedparameters
- the parameters of the method that was just invokedAbstractInvocationHandler.postInvoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
public <R> java.util.SortedMap<Database<D>,R> handlePartialFailure(java.util.SortedMap<Database<D>,R> resultMap, java.util.SortedMap<Database<D>,java.lang.Exception> exceptionMap) throws java.lang.Exception
handlePartialFailure
in interface SQLProxy<D,S extends java.sql.Statement>
handlePartialFailure
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
java.lang.Exception
SQLProxy.handlePartialFailure(java.util.SortedMap, java.util.SortedMap)
protected boolean isSelectForUpdate(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
protected java.util.List<java.util.concurrent.locks.Lock> extractLocks(java.lang.String sql) throws java.sql.SQLException
java.sql.SQLException
protected DatabaseProperties getDatabaseProperties() throws java.sql.SQLException
java.sql.SQLException
protected void close(java.sql.Connection connection, S statement) throws java.sql.SQLException
close
in class AbstractChildInvocationHandler<D,java.sql.Connection,S extends java.sql.Statement>
java.sql.SQLException
AbstractChildInvocationHandler.close(java.lang.Object, java.lang.Object)
protected void record(Invoker<D,S,?> invoker, java.lang.reflect.Method method, java.lang.Object[] parameters)
record
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
AbstractInvocationHandler.record(net.sf.hajdbc.sql.Invoker, java.lang.reflect.Method, java.lang.Object[])
protected boolean isRecordable(java.lang.reflect.Method method)
isRecordable
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
AbstractInvocationHandler.isRecordable(java.lang.reflect.Method)
protected boolean isBatchMethod(java.lang.reflect.Method method)
protected boolean isEndBatchMethod(java.lang.reflect.Method method)
protected void replay(Database<D> database, S statement) throws java.lang.Exception
replay
in class AbstractInvocationHandler<D,S extends java.sql.Statement>
java.lang.Exception
AbstractInvocationHandler.replay(net.sf.hajdbc.Database, java.lang.Object)