org.ozoneDB.odmg
Class OzoneODMGTransaction
java.lang.Object
org.ozoneDB.odmg.OzoneODMGTransaction
- All Implemented Interfaces:
- Transaction
- public final class OzoneODMGTransaction
- extends java.lang.Object
- implements Transaction
Implementation of the ODMG Transaction
interface. A transaction works
against all databases that are known by the OzoneODMG factory
object when this transaction is created.
- Version:
- $Revision: 1.1 $Date: 2001/12/18 10:31:31 $
- Author:
- SMB
- See Also:
Transaction
Method Summary |
void |
abort()
Abort and close the transaction.
|
void |
begin()
Start a transaction.
|
void |
checkpoint()
Commit the transaction, but reopen the transaction, retaining all locks.
|
void |
commit()
Commit and close the transaction.
|
protected static OzoneODMGTransaction |
current()
|
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. |
protected static void |
remove(OzoneODMGTransaction tx)
Remove all threads that have joined the specified transaction. |
boolean |
tryLock(java.lang.Object obj,
int lockMode)
Upgrade the lock on the given object to the given lock mode.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OzoneODMGTransaction
public OzoneODMGTransaction(org.ozoneDB.DxLib.DxCollection _dbs)
current
protected static OzoneODMGTransaction current()
remove
protected static void remove(OzoneODMGTransaction tx)
- Remove all threads that have joined the specified transaction.
- Parameters:
tx
- Transaction to remove from the global thread table.
begin
public void begin()
- Description copied from interface:
Transaction
- Start a transaction.
Calling
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.
- Specified by:
begin
in interface Transaction
join
public void join()
- Description copied from interface:
Transaction
- Attach the caller's thread to this
Transaction
and detach the thread
from any former Transaction
the thread may have been associated with.
- Specified by:
join
in interface Transaction
leave
public void leave()
- Description copied from interface:
Transaction
- Detach the caller's thread from this
Transaction
, but do not attach
the thread to another Transaction
.
- Specified by:
leave
in interface Transaction
isOpen
public boolean isOpen()
- Description copied from interface:
Transaction
- Determine whether the transaction is open or not.
A transaction is open if a call has been made to
begin
,
but a subsequent call to either commit
or abort
has not been made.
- Specified by:
isOpen
in interface Transaction
- Returns:
- True if the transaction is open, otherwise false.
commit
public void commit()
- Description copied from interface:
Transaction
- Commit and close the transaction.
Calling
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
- Specified by:
commit
in interface Transaction
abort
public void abort()
- Description copied from interface:
Transaction
- Abort and close the transaction.
Calling abort abandons all persistent object modifications and releases the
associated locks.
Aborting a transaction does not restore the state of modified transient objects
- Specified by:
abort
in interface Transaction
checkpoint
public void checkpoint()
- Description copied from interface:
Transaction
- Commit the transaction, but reopen the transaction, retaining all locks.
Calling
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.
- Specified by:
checkpoint
in interface Transaction
lock
public void lock(java.lang.Object obj,
int lockMode)
throws LockNotGrantedException
- Upgrade the lock on the given object to the given lock mode. The call
has no effect if the object's current lock is already at or above that
level of lock mode.
This method does nothing currently. We rely on the class descriptor for
lock modes for now.
- Specified by:
lock
in interface Transaction
- Parameters:
obj
- The object to acquire a lock on.lockMode
- The lock mode to acquire. The lock modes are READ
,
UPGRADE
, and WRITE
.
- Throws:
LockNotGrantedException
- Is thrown if the given lock mode could not be acquired.
tryLock
public boolean tryLock(java.lang.Object obj,
int lockMode)
- Upgrade the lock on the given object to the given lock mode.
This method does nothing currently. We rely on the class descriptor for
lock modes for now.
- Specified by:
tryLock
in interface Transaction
- Parameters:
obj
- The object to acquire a lock on.lockMode
- The lock mode to acquire. The lock modes are READ
,
UPGRADE
, and WRITE
.
- Returns:
- True if the lock has been acquired, otherwise false.
Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.