private class BufferManager.TxWrapper extends java.lang.Object implements Finalizable, Commitable
Commitable
and Finalizable
events of an
application transaction. It creates a database transaction to correspond with the application
transaction, and as it receives events from the TransactionManager
, it delegates related
responsibilities to various components of the persistence framework.Modifier and Type | Field and Description |
---|---|
private boolean |
autoRollback
Roll back the transaction when block finishes, if not previously acted upon
|
private Database |
database
Backing database
|
private DirtyShareContext |
dirtyContext
Dirty share context
|
private boolean |
initialTx
true for an initial transaction only until the first commit or rollback |
private Persistence.Context |
persistenceCtx
Persistence context, for access to database session and transaction
|
private SavepointManager |
savepointManager
Savepoint manager (can be
null |
Constructor and Description |
---|
TxWrapper(Database database)
The sole constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
activate()
Activates the transaction.
|
private void |
begin()
Starts the actual transaction at persistence level.
|
void |
commit(boolean transaction)
Implementation of
Commitable interface: saves any temporary state to the persistent form or
storage that is associated with this class. |
void |
deleted()
Implementation of
Finalizable interface: provides a notification that the external program
in which the object is registered is being deleted and the object's reference may be lost after this
method is called. |
private void |
end()
Shuts down the transaction at persistence level and performs key management.
|
void |
finished()
Implementation of
Finalizable interface: Provides a notification that the scope in which the
object is registered is ending and the object's reference may or may not be lost after this method
is called. |
(package private) boolean |
isActive()
Checks whether this
TxWrapper is active. |
void |
iterate()
Implementation of
Finalizable interface: provides a notification that the block whose scope
in which the object is registered is about to iterate and attempt another pass. |
(package private) void |
registerSavepointHooks(boolean fullTx)
Registers the commitable and finalizable for savepoint manager, if any.
|
void |
retry()
Implementation of
Finalizable interface: provides a notification that the block whose scope
in which the object is registered is about to retry the same iteration (all loop control data is
unchanged). |
void |
rollback(boolean transaction)
Implementation of
Commitable interface: notifies that a rollback has just occurred (all state
maintained through the Undoable interface has been already rolled back). |
java.lang.String |
toString()
Convert the current object to its string representation to be used during debugging.
|
void |
validate(boolean transaction,
boolean aggressiveFlush)
Implementation of
Commitable interface: Notifies that a block is about to be normally exited
or normally iterated and that any deferred validation processing should be executed. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
entry, initFailure, weight
private final Database database
private final DirtyShareContext dirtyContext
private final SavepointManager savepointManager
null
private Persistence.Context persistenceCtx
private boolean autoRollback
private boolean initialTx
true
for an initial transaction only until the first commit or rollbackTxWrapper(Database database)
database
- The Database
where the transaction takes place.public void iterate()
Finalizable
interface: provides a notification that the block whose scope
in which the object is registered is about to iterate and attempt another pass. This provides an
opportunity to preserve state from the previous pass and make preparations for the coming pass.iterate
in interface Finalizable
public void retry()
Finalizable
interface: provides a notification that the block whose scope
in which the object is registered is about to retry the same iteration (all loop control data is
unchanged). This provides an opportunity to clear or reset state from the previous pass.retry
in interface Finalizable
public void finished()
Finalizable
interface: Provides a notification that the scope in which the
object is registered is ending and the object's reference may or may not be lost after this method
is called. This provides a natural and standard mechanism to clean-up any resources that may need
to be closed explicitly such as operating system files or sockets.finished
in interface Finalizable
public void deleted()
Finalizable
interface: provides a notification that the external program
in which the object is registered is being deleted and the object's reference may be lost after this
method is called.deleted
in interface Finalizable
public void commit(boolean transaction)
Commitable
interface: saves any temporary state to the persistent form or
storage that is associated with this class.commit
in interface Commitable
transaction
- true
if this is a full transaction and false
if this is only a
sub-transaction (a nested scope with transaction support).public void rollback(boolean transaction)
Commitable
interface: notifies that a rollback has just occurred (all state
maintained through the Undoable
interface has been already rolled back). This notification
can be used to implement cleanup of any custom state that needs to be maintained in this case. It can
also be used to implement a rollback that is completely independent of the Undoable
(externally driven) interface.rollback
in interface Commitable
transaction
- true
if this is a full transaction and false
if this is only a
sub-transaction (a nested scope with transaction support).public void validate(boolean transaction, boolean aggressiveFlush)
Commitable
interface: Notifies that a block is about to be normally exited
or normally iterated and that any deferred validation processing should be executed.
This particular implementation is a NOP.
validate
in interface Commitable
transaction
- Ignored.aggressiveFlush
- Ignored.void registerSavepointHooks(boolean fullTx)
fullTx
- true
if this is a full-transaction.void activate()
boolean isActive()
TxWrapper
is active.true
only if TxWrapper
was activated.public java.lang.String toString()
toString
in class java.lang.Object
private void begin()
private void end()