public class TopLevelTransaction extends Object implements Transaction
| Constructor and Description |
|---|
TopLevelTransaction(org.neo4j.kernel.impl.transaction.AbstractTransactionManager transactionManager,
org.neo4j.kernel.impl.core.TransactionState state) |
| Modifier and Type | Method and Description |
|---|---|
Lock |
acquireReadLock(PropertyContainer entity)
Acquires a read lock for
entity for this transaction. |
Lock |
acquireWriteLock(PropertyContainer entity)
Acquires a write lock for
entity for this transaction. |
void |
close()
Commits or marks this transaction for rollback, depending on whether
Transaction.success() or Transaction.failure() has been previously invoked. |
void |
failure()
Marks this transaction as failed, which means that it will
unconditionally be rolled back when
Transaction.close() is called. |
void |
finish()
Commits or marks this transaction for rollback, depending on whether
Transaction.success() or Transaction.failure() has been previously invoked. |
void |
success()
Marks this transaction as successful, which means that it will be
committed upon invocation of
Transaction.close() unless Transaction.failure()
has or will be invoked before then. |
public TopLevelTransaction(org.neo4j.kernel.impl.transaction.AbstractTransactionManager transactionManager, org.neo4j.kernel.impl.core.TransactionState state)
public void failure()
TransactionTransaction.close() is called. Once
this method has been invoked, it doesn't matter if
Transaction.success() is invoked afterwards -- the transaction will still be
rolled back.failure in interface Transactionpublic void success()
TransactionTransaction.close() unless Transaction.failure()
has or will be invoked before then.success in interface Transactionpublic final void finish()
TransactionTransaction.success() or Transaction.failure() has been previously invoked.
All ResourceIterables that where returned from operations executed inside this
transaction will be automatically closed by this method.
Preferably this method will not be used, instead a Transaction should participate in a
try-with-resource statement so that Transaction.close() is automatically called instead.
Invoking Transaction.close() (which is unnecessary when in try-with-resource statement) or Transaction.finish()
has the exact same effect.finish in interface Transactionpublic void close()
TransactionTransaction.success() or Transaction.failure() has been previously invoked.
All ResourceIterables that where returned from operations executed inside this
transaction will be automatically closed by this method.
This method comes from AutoCloseable so that a Transaction can participate
in try-with-resource statements. It will not throw any declared exception, just like Transaction.finish().
Invoking Transaction.close() (which is unnecessary when in try-with-resource statement) or Transaction.finish()
has the exact same effect.close in interface AutoCloseableclose in interface Transactionpublic Lock acquireWriteLock(PropertyContainer entity)
Transactionentity for this transaction.
The lock (returned from this method) can be released manually, but
if not it's released automatically when the transaction finishes.acquireWriteLock in interface Transactionentity - the entity to acquire a lock for. If another transaction
currently holds a write lock to that entity this call will wait until
it's released.Lock which optionally can be used to release this
lock earlier than when the transaction finishes. If not released
(with Lock.release() it's going to be released with the
transaction finishes.public Lock acquireReadLock(PropertyContainer entity)
Transactionentity for this transaction.
The lock (returned from this method) can be released manually, but
if not it's released automatically when the transaction finishes.acquireReadLock in interface Transactionentity - the entity to acquire a lock for. If another transaction
currently hold a write lock to that entity this call will wait until
it's released.Lock which optionally can be used to release this
lock earlier than when the transaction finishes. If not released
(with Lock.release() it's going to be released with the
transaction finishes.Copyright © 2002–2013 The Neo4j Graph Database Project. All rights reserved.