|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ojb.odmg.TransactionImpl
Implementation of Transaction for org.odmg.Transaction.
Field Summary |
Fields inherited from interface org.odmg.Transaction |
READ, UPGRADE, WRITE |
Constructor Summary | |
TransactionImpl(TransactionTable theTxTable,
DatabaseImpl theCurrentDB)
Creates new Transaction |
Method Summary | |
void |
abort()
Abort and close the transaction. |
void |
afterMaterialization(IndirectionHandler handler,
java.lang.Object materializedObject)
this callback is invoked after an Object is materialized within an IndirectionHandler. |
void |
beforeMaterialization(IndirectionHandler handler,
Identity oid)
this callback is invoked before an Object is materialized within an IndirectionHandler. |
void |
begin()
Start a transaction. |
void |
checkpoint()
Commit the transaction, but reopen the transaction, retaining all locks. |
void |
commit()
Commit and close the transaction. |
PersistenceBroker |
getBroker()
Gets the broker associated with the transaction. |
java.lang.String |
getGUID()
|
(package private) Identity |
getNrmEntry(java.lang.String name)
lookup an identity from the transactions temporary nrm table. |
boolean |
isOpen()
Determine whether the transaction is open or not. |
void |
join()
Attach the caller's thread to this Transaction and detach the
thread from any former Transaction the thread may have been
associated with. |
void |
leave()
Detach the caller's thread from this Transaction , but do not
attach the thread to another Transaction . |
void |
lock(java.lang.Object obj,
int lockMode)
Upgrade the lock on the given object to the given lock mode. |
void |
markDelete(java.lang.Object anObject)
marks an object for deletion |
(package private) void |
putNrmEntry(java.lang.String key,
Identity value)
make a binding name/identity to the transactions temporary nrm table. |
protected void |
registerToIndirectionHandler(IndirectionHandler handler)
|
boolean |
tryLock(java.lang.Object obj,
int lockMode)
Upgrade the lock on the given object to the given lock mode. |
(package private) boolean |
unbindNrmEntry(java.lang.String key)
unbind an entry from the transactions temporary nrm table. |
protected void |
unRegisterFromAllIndirectionHandlers()
|
protected void |
unregisterFromIndirectionHandler(IndirectionHandler handler)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TransactionImpl(TransactionTable theTxTable, DatabaseImpl theCurrentDB)
theTxTable
- - Transaction table so we can manage this and
other transactions.Method Detail |
public boolean isOpen()
begin
, but a subsequent call to
either commit
or abort
has not been made.
isOpen
in interface Transaction
public void join()
Transaction
and detach the
thread from any former Transaction
the thread may have been
associated with.
join
in interface Transaction
public void lock(java.lang.Object obj, int lockMode) throws LockNotGrantedException
lock
in interface Transaction
obj
- object to acquire a lock on.lockMode
- lock mode to acquire. The lock modes
are READ
, UPGRADE
, and WRITE
.
LockNotGrantedException
- Description of Exceptionpublic void leave()
Transaction
, but do not
attach the thread to another Transaction
.
leave
in interface Transaction
public void checkpoint()
checkpoint
commits persistent object modifications
made within the transaction since the last checkpoint to the database. The
transaction retains all locks it held on those objects at the time the
checkpoint was invoked.
checkpoint
in interface Transaction
public boolean tryLock(java.lang.Object obj, int lockMode)
tryLock
is the same as lock
except it returns a boolean
indicating whether the lock was granted instead of generating an exception.
tryLock
in interface Transaction
obj
- Description of ParameterlockMode
- Description of Parameter
UPGRADE
, and WRITE
.public void commit()
commit
commits to
the database all persistent object modifications within the transaction and
releases any locks held by the transaction. A persistent object
modification is an update of any field of an existing persistent object, or
an update or creation of a new named object in the database. If a
persistent object modification results in a reference from an existing
persistent object to a transient object, the transient object is moved to
the database, and all references to it updated accordingly. Note that the
act of moving a transient object to the database may create still more
persistent references to transient objects, so its referents must be
examined and moved as well. This process continues until the database
contains no references to transient objects, a condition that is guaranteed
as part of transaction commit. Committing a transaction does not remove
from memory transient objects created during the transaction.
The updateObjectList contains a list of all objects for which this transaction
has write privledge to. We need to update these objects.
commit
in interface Transaction
public void abort()
abort
in interface Transaction
public void begin()
begin
multiple times on the same
transaction object, without an intervening call to commit
or
abort
, causes the exception
TransactionInProgressException
to be thrown on the second and
subsequent calls. Operations executed before a transaction has been opened,
or before reopening after a transaction is aborted or committed, have
undefined results; these may throw a
TransactionNotInProgressException
exception.
begin
in interface Transaction
public java.lang.String getGUID()
public void markDelete(java.lang.Object anObject)
anObject
- Object to be markedIdentity getNrmEntry(java.lang.String name)
name
- - the name to lookup.
void putNrmEntry(java.lang.String key, Identity value)
key
- - the identifying namevalue
- the Identity to storeboolean unbindNrmEntry(java.lang.String key)
key
- - the identifying string whose entry is to be deleted.public void beforeMaterialization(IndirectionHandler handler, Identity oid)
beforeMaterialization
in interface MaterializationListener
handler
- the invoking handleroid
- the identity of the object to be materializedpublic void afterMaterialization(IndirectionHandler handler, java.lang.Object materializedObject)
afterMaterialization
in interface MaterializationListener
handler
- the invoking handlermaterializedObject
- the materialized Objectprotected void unRegisterFromAllIndirectionHandlers()
protected void unregisterFromIndirectionHandler(IndirectionHandler handler)
protected void registerToIndirectionHandler(IndirectionHandler handler)
public PersistenceBroker getBroker()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |