|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecthelma.objectmodel.db.Transactor
public class Transactor
A subclass of thread that keeps track of changed nodes and triggers changes in the database when a transaction is commited.
| Field Summary | |
|---|---|
protected ITransaction |
txn
|
| Method Summary | |
|---|---|
void |
abort()
Abort the current transaction, rolling back all changes made. |
void |
begin(java.lang.String name)
Start a new transaction with the given name. |
void |
closeConnections()
Closes all open JDBC connections |
void |
commit()
Commit the current transaction, persisting all changes to DB. |
void |
dropCleanNode(Key key)
Drop a reference to an unmodified Node previously registered with visitCleanNode(). |
void |
dropDirtyNode(Node node)
Unmark a Node that has previously been marked as modified during the transaction |
Node |
getCleanNode(java.lang.Object key)
Get a reference to an unmodified Node local to this transaction |
java.sql.Connection |
getConnection(DbSource src)
Get a db connection that was previously registered with this transactor thread. |
Node |
getDirtyNode(Key key)
Get a dirty Node from this transaction. |
static Transactor |
getInstance()
Get the transactor for the current thread or null if none exists. |
static Transactor |
getInstance(NodeManager nmgr)
Get the transactor for the current thread, creating a new one if none exists. |
static Transactor |
getInstanceOrFail()
Get the transactor for the current thread or throw a IllegalStateException if none exists. |
java.lang.String |
getTransactionName()
Return the name of the current transaction. |
boolean |
isActive()
Returns true if a transaction is currently active. |
boolean |
isAlive()
Check whether the thread associated with this transactor is alive. |
void |
kill()
Kill this transaction thread. |
void |
registerConnection(DbSource src,
java.sql.Connection con)
Register a db connection with this transactor thread. |
java.lang.String |
toString()
Return a string representation of this Transactor thread |
void |
visitCleanNode(Key key,
Node node)
Keep a reference to an unmodified Node local to this transaction |
void |
visitCleanNode(Node node)
Keep a reference to an unmodified Node local to this transaction |
void |
visitDirtyNode(Node node)
Mark a Node as modified/created/deleted during this transaction |
void |
visitParentNode(Node node)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ITransaction txn
| Method Detail |
|---|
public static Transactor getInstance()
public static Transactor getInstanceOrFail()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - if no transactor is associated with the current threadpublic static Transactor getInstance(NodeManager nmgr)
nmgr - the NodeManager used to create the transactor
public void visitDirtyNode(Node node)
node - ...public void dropDirtyNode(Node node)
node - ...public Node getDirtyNode(Key key)
key - the key
public void visitCleanNode(Node node)
node - the node to register
public void visitCleanNode(Key key,
Node node)
key - the key to register withnode - the node to registerpublic void dropCleanNode(Key key)
key - the keypublic Node getCleanNode(java.lang.Object key)
key - ...
public void visitParentNode(Node node)
node - ...public boolean isActive()
public boolean isAlive()
public void registerConnection(DbSource src,
java.sql.Connection con)
src - the db sourcecon - the connectionpublic java.sql.Connection getConnection(DbSource src)
src - the db source
public void begin(java.lang.String name)
throws java.lang.Exception
name - The name of the transaction. This is usually the request
path for the underlying HTTP request.
java.lang.Exception - ...
public void commit()
throws java.lang.Exception
java.lang.Exception - ...public void abort()
public void kill()
public void closeConnections()
public java.lang.String getTransactionName()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||