|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.core.Transaction
This class represents an internal transaction.
Most methods of this class are synchronized. In fact, this is not strictly needed because a transaction is invoked by one thread (associated with this transaction) only.
All public methods are wrapped into try/catch statements to convert thrown exception into OzoneInternalException. So the client gets OzoneRemoteException, if an object could not be found or something; OzoneInternalException, if there was a critical internal error; any other exceptions were thrown by the user code.
Field Summary | |
protected int |
acquireCount
|
protected ObjectID |
blocker
The ID of the object (container) that blocks this transaction. |
protected long |
blockTimeout
|
protected org.ozoneDB.data.SimpleArrayList |
callStack
The list of ObjectContainer s which are called by this transactions but where the call
is not completed. |
protected int |
commandCount
|
protected boolean |
deadlocked
Are we deadlocked? |
protected long |
deadlockWaitTimeMaximum
The maximum time (in milliseconds) to wait after a deadlock. |
protected static long |
deadlockWaitTimeMaximumMaximum
The maximum deadlockWaitTimeMaximum can have. |
protected static long |
deadlockWaitTimeMaximumMinimum
The minimum deadlockWaitTimeMaximum can have. |
protected Env |
env
The environment of this object. |
static int |
HASHTABLE_INIT_SIZE
|
protected int |
maxLockLevel
|
protected User |
owner
|
protected java.lang.String |
ownerName
|
protected boolean |
rollbackOnly
|
protected boolean |
sleeping
Is this thread sleeping? |
protected long |
startTime
|
protected int |
status
|
static int |
STATUS_ABORTED
Status of a transaction: transaction has been aborted. |
static int |
STATUS_ABORTING
Status of a transaction: transaction is about to abort. |
static int |
STATUS_COMMITED
Status of a transaction: transaction has been successfully committed. |
static int |
STATUS_COMMITING
Status of a transaction: transaction is about to commit. |
static int |
STATUS_NONE
Status of a transaction: transaction is not active. |
static int |
STATUS_PREPARED
Status of a transaction: transaction has been successfully prepared. |
static int |
STATUS_PREPARING
Status of a transaction: transaction is about to prepare. |
static int |
STATUS_STARTED
Status of a transaction: transaction has been started. |
protected boolean |
stopped
|
protected TransactionID |
taID
|
Constructor Summary | |
protected |
Transaction(Env env,
User owner)
Construct a new transaction. |
protected |
Transaction(TransactionID _taID)
Construct a new transaction. |
Method Summary | |
void |
abort(DbCommand command)
Once this method is called it MUST cleanup the entire transaction stuff without exception. |
protected ObjectContainer |
acquireContainer(ObjectContainer container,
int lockLevel)
|
ObjectContainer |
acquireObject(ObjectID id,
int lockLevel)
Set a lock on the container specified by the given object ID and join the container to this transaction. |
Lockable |
blockedBy()
Helper method to implement the Locker interface to support deadlock recognition via core.dr package |
protected void |
callOnActivateIfNeeded(ObjectContainer container)
|
protected void |
callOnPassivateIfNeeded(ObjectContainer container)
|
void |
commit()
Commit this transaction. |
ObjectContainer |
copyObject(ObjectID id)
|
ObjectContainer |
createObject(java.lang.String className,
int access,
java.lang.String name,
java.lang.String sig,
java.lang.Object[] args,
ObjectID id)
Create a new database object. |
void |
deleteObject(ObjectID id)
|
boolean |
equals(java.lang.Object obj)
|
void |
finalize()
|
org.ozoneDB.data.SimpleArrayList |
getCallStack()
|
protected long |
getDeadlockWaitTimeMaximum()
|
TransactionManager |
getManager()
|
protected long |
increaseDeadlockWaitTimeMaximum()
|
java.lang.Object |
invokeObject(ObjectID id,
int methodIndex,
java.lang.Object[] args,
int lockLevel)
|
java.lang.Object |
invokeObject(ObjectID id,
java.lang.String methodName,
java.lang.String sig,
java.lang.Object[] args,
int lockLevel)
|
boolean |
isBlocked()
Returns wether this locker is blocked. |
boolean |
isDeadlocked()
|
protected boolean |
isSleeping()
|
int |
maxLockLevel()
|
void |
nameObject(ObjectID id,
java.lang.String name)
|
org.ozoneDB.OzoneProxy |
objectForID(ObjectID id)
|
org.ozoneDB.OzoneProxy |
objectForName(java.lang.String name)
|
DxSet |
objectNames()
|
User |
owner()
|
boolean |
performCommand(DbCommand command)
|
void |
prepareCommit()
|
void |
releaseObject(ObjectContainer objectContainer)
The corresponding method to acquireObject(org.ozoneDB.core.ObjectID, int) .
|
void |
requireWriteLockingCallByUser(ObjectContainer container)
A user calls OzoneObject.requireWriteLocking() .
|
void |
reset()
|
void |
setDeadlocked(boolean to)
|
protected void |
setDeadlockWaitTimeMaximum(long to)
|
void |
sleep(long millis)
|
int |
status()
|
void |
stop()
|
TransactionID |
taID()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int STATUS_NONE
public static final int STATUS_STARTED
public static final int STATUS_PREPARING
public static final int STATUS_PREPARED
public static final int STATUS_COMMITING
public static final int STATUS_COMMITED
public static final int STATUS_ABORTING
public static final int STATUS_ABORTED
public static final int HASHTABLE_INIT_SIZE
protected transient Env env
protected TransactionID taID
protected java.lang.String ownerName
protected User owner
protected int status
protected boolean rollbackOnly
protected int maxLockLevel
protected int commandCount
protected ObjectID blocker
protected long blockTimeout
protected long startTime
protected int acquireCount
protected boolean stopped
protected boolean deadlocked
protected static final long deadlockWaitTimeMaximumMinimum
protected static final long deadlockWaitTimeMaximumMaximum
protected long deadlockWaitTimeMaximum
protected boolean sleeping
protected org.ozoneDB.data.SimpleArrayList callStack
ObjectContainer
s which are called by this transactions but where the call
is not completed. The last object called is represented by the ObjectContainer
with
the greatest index in the list.
Constructor Detail |
protected Transaction(Env env, User owner)
env
- Environment of this transaction.owner
- User that has started this transaction.protected Transaction(TransactionID _taID)
Method Detail |
public void stop()
public void reset()
protected void setDeadlockWaitTimeMaximum(long to)
protected long getDeadlockWaitTimeMaximum()
protected long increaseDeadlockWaitTimeMaximum()
public void setDeadlocked(boolean to)
setDeadlocked
in interface Locker
public boolean isDeadlocked()
isDeadlocked
in interface Locker
public int status()
public User owner()
public int maxLockLevel()
public void releaseObject(ObjectContainer objectContainer)
acquireObject(org.ozoneDB.core.ObjectID, int)
.
protected void callOnPassivateIfNeeded(ObjectContainer container)
public ObjectContainer acquireObject(ObjectID id, int lockLevel) throws org.ozoneDB.ObjectNotFoundException, java.io.IOException, java.lang.ClassNotFoundException, org.ozoneDB.TransactionException, TransactionError
id
- ObjectID of the container which we try to join to this transaction.lockLevel
- The lock level we need on this object (container).
org.ozoneDB.ObjectNotFoundException
- If there is no such object.
java.io.IOException
java.lang.ClassNotFoundException
org.ozoneDB.TransactionException
TransactionError
protected void callOnActivateIfNeeded(ObjectContainer container)
protected ObjectContainer acquireContainer(ObjectContainer container, int lockLevel) throws PermissionError, org.ozoneDB.TransactionException, TransactionError, java.io.IOException, org.ozoneDB.ObjectNotFoundException, java.lang.ClassNotFoundException
PermissionError
org.ozoneDB.TransactionException
TransactionError
java.io.IOException
org.ozoneDB.ObjectNotFoundException
java.lang.ClassNotFoundException
public void requireWriteLockingCallByUser(ObjectContainer container)
OzoneObject.requireWriteLocking()
.
This means that no user-visible declaed exceptions can be thrown. Thus,
the same measures regarding catching and wrapping exceptions have to be taken as in invokeObject(org.ozoneDB.core.ObjectID, java.lang.String, java.lang.String, java.lang.Object[], int)
.
public boolean performCommand(DbCommand command)
public void prepareCommit() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void commit() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void abort(DbCommand command) throws java.io.IOException, java.lang.ClassNotFoundException
Note: This may be called after/from prepareCommit() !
java.io.IOException
java.lang.ClassNotFoundException
public Lockable blockedBy()
blockedBy
in interface Locker
public boolean isBlocked()
isBlocked
in interface Locker
public ObjectContainer createObject(java.lang.String className, int access, java.lang.String name, java.lang.String sig, java.lang.Object[] args, ObjectID id) throws java.lang.Exception, org.ozoneDB.OzoneObjectException
className
- access
- name
- id
- The ID of the new container or null.
org.ozoneDB.PermissionDeniedException
- If user in invalid, name is already in
use, target is not OzoneCompatible...
java.lang.Exception
org.ozoneDB.OzoneObjectException
public ObjectContainer copyObject(ObjectID id) throws java.lang.Exception
java.lang.Exception
public void deleteObject(ObjectID id) throws org.ozoneDB.ObjectNotFoundException, java.io.IOException, java.lang.ClassNotFoundException, org.ozoneDB.TransactionException, TransactionError, org.ozoneDB.OzoneRemoteException, org.ozoneDB.OzoneInternalException, org.ozoneDB.OzoneObjectException
org.ozoneDB.ObjectNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
org.ozoneDB.TransactionException
TransactionError
org.ozoneDB.OzoneRemoteException
org.ozoneDB.OzoneInternalException
org.ozoneDB.OzoneObjectException
public java.lang.Object invokeObject(ObjectID id, java.lang.String methodName, java.lang.String sig, java.lang.Object[] args, int lockLevel) throws java.lang.Exception, org.ozoneDB.OzoneObjectException
id
- methodName
- sig
- lockLevel
-
java.lang.Exception
org.ozoneDB.OzoneObjectException
public java.lang.Object invokeObject(ObjectID id, int methodIndex, java.lang.Object[] args, int lockLevel) throws java.lang.Exception, org.ozoneDB.OzoneObjectException
java.lang.Exception
org.ozoneDB.OzoneObjectException
public void nameObject(ObjectID id, java.lang.String name) throws java.lang.Exception
java.lang.Exception
public DxSet objectNames() throws java.lang.Exception
java.lang.Exception
public org.ozoneDB.OzoneProxy objectForName(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public org.ozoneDB.OzoneProxy objectForID(ObjectID id) throws java.lang.Exception
java.lang.Exception
public void sleep(long millis)
protected boolean isSleeping()
public TransactionID taID()
public boolean equals(java.lang.Object obj)
public java.lang.String toString()
public void finalize() throws java.lang.Throwable
java.lang.Throwable
public org.ozoneDB.data.SimpleArrayList getCallStack()
public TransactionManager getManager()
|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |