Package edu.caltech.nanodb.transactions
Class TransactionStateUpdater
- java.lang.Object
-
- edu.caltech.nanodb.transactions.TransactionStateUpdater
-
- All Implemented Interfaces:
CommandEventListener
public class TransactionStateUpdater extends java.lang.Object implements CommandEventListener
This implementation of theCommandEventListener
interface manages the transaction state enclosing each command executed by the database. This includes starting a transaction before each command, if one is not already in progress, and committing the transaction if it was not user-initiated.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private TransactionManager
transactionManager
-
Constructor Summary
Constructors Constructor Description TransactionStateUpdater(TransactionManager transactionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterCommandExecuted(Command cmd)
This method is called after a command is executed, to allow listeners to perform after-command processing.void
beforeCommandExecuted(Command cmd)
This method is called before a command is executed, to allow listeners to perform before-command processing.
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
A logging object for reporting anything interesting that happens.
-
transactionManager
private TransactionManager transactionManager
-
-
Constructor Detail
-
TransactionStateUpdater
public TransactionStateUpdater(TransactionManager transactionManager)
-
-
Method Detail
-
beforeCommandExecuted
public void beforeCommandExecuted(Command cmd) throws EventDispatchException
Description copied from interface:CommandEventListener
This method is called before a command is executed, to allow listeners to perform before-command processing.- Specified by:
beforeCommandExecuted
in interfaceCommandEventListener
- Parameters:
cmd
- the command about to be executed- Throws:
EventDispatchException
-
afterCommandExecuted
public void afterCommandExecuted(Command cmd) throws EventDispatchException
Description copied from interface:CommandEventListener
This method is called after a command is executed, to allow listeners to perform after-command processing.- Specified by:
afterCommandExecuted
in interfaceCommandEventListener
- Parameters:
cmd
- the command that was just executed- Throws:
EventDispatchException
-
-