com.heckmansoft.surjey.model.datastore
Class Transaction

java.lang.Object
  extended bycom.heckmansoft.surjey.model.datastore.Transaction

public class Transaction
extends java.lang.Object

Manages a transaction for a given connection.


Field Summary
protected  java.sql.Connection connection
           
protected  org.apache.log4j.Logger log
           
 
Constructor Summary
Transaction(java.sql.Connection connection)
           
 
Method Summary
 void commit()
          Attempt to commit the transaction.
 void finish(boolean status)
          Finish the transaction by either commiting or rolling back depending on the value of given argument.
 void incrementUsers()
          Notify the transaction there is an additional user.
 void rollback()
          Attempt to rollback the transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected java.sql.Connection connection

log

protected org.apache.log4j.Logger log
Constructor Detail

Transaction

public Transaction(java.sql.Connection connection)
Method Detail

incrementUsers

public void incrementUsers()
Notify the transaction there is an additional user.


finish

public void finish(boolean status)
Finish the transaction by either commiting or rolling back depending on the value of given argument.

Parameters:
status - Whether to commit (true) or rollback (false).

commit

public void commit()
Attempt to commit the transaction. Does not commit if there are still currently users of the transaction. Will rollback if any other user has attempted a rollback.


rollback

public void rollback()
Attempt to rollback the transaction. Does not rollback if there are still currently users of the transaction.