com.jolbox.bonecp
Class MemorizeTransactionProxy

java.lang.Object
  extended by com.jolbox.bonecp.MemorizeTransactionProxy
All Implemented Interfaces:
InvocationHandler

public class MemorizeTransactionProxy
extends Object
implements InvocationHandler

This code takes care of recording and playing back of transactions (when a failure occurs). The idea behind this is to wrap a connection or statement with proxies and log all method calls. When a failure occurs, thrash the inner connection, obtain a new one and play back the previously recorded methods.

Author:
Wallace

Constructor Summary
MemorizeTransactionProxy()
          Default constructor.
 
Method Summary
 Object invoke(Object proxy, Method method, Object[] args)
           
protected static CallableStatement memorize(CallableStatement target, ConnectionHandle connectionHandle)
          Wrap CallableStatement with a proxy.
protected static Connection memorize(Connection target, ConnectionHandle connectionHandle)
          Wrap connection with a proxy.
protected static PreparedStatement memorize(PreparedStatement target, ConnectionHandle connectionHandle)
          Wrap PreparedStatement with a proxy.
protected static Statement memorize(Statement target, ConnectionHandle connectionHandle)
          Wrap Statement with a proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemorizeTransactionProxy

public MemorizeTransactionProxy()
Default constructor.

Method Detail

memorize

protected static Connection memorize(Connection target,
                                     ConnectionHandle connectionHandle)
Wrap connection with a proxy.

Parameters:
target - connection handle
connectionHandle - originating bonecp connection
Returns:
Proxy to a connection.

memorize

protected static Statement memorize(Statement target,
                                    ConnectionHandle connectionHandle)
Wrap Statement with a proxy.

Parameters:
target - statement handle
connectionHandle - originating bonecp connection
Returns:
Proxy to a statement.

memorize

protected static PreparedStatement memorize(PreparedStatement target,
                                            ConnectionHandle connectionHandle)
Wrap PreparedStatement with a proxy.

Parameters:
target - statement handle
connectionHandle - originating bonecp connection
Returns:
Proxy to a Preparedstatement.

memorize

protected static CallableStatement memorize(CallableStatement target,
                                            ConnectionHandle connectionHandle)
Wrap CallableStatement with a proxy.

Parameters:
target - statement handle
connectionHandle - originating bonecp connection
Returns:
Proxy to a Callablestatement.

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable


Copyright © 2009-2011 JolBox. All Rights Reserved.