|
ozone core API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.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 OzoneInternalExc. So the client gets OzoneRemoteExc, if an object could not be found or something; OzoneInternalExc, 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 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
|
private java.lang.Object |
data
Data that the StoreManager implementation uses to hold data that is associated with this transaction. |
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 | |
Transaction(Env _env,
User _owner)
Construct a new transaction. |
|
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 |
acquireObjectAndPin(ObjectID id,
int lockLevel)
Set a lock on the container specified by the given object ID and join the container to this transaction. |
Lockable |
blockedByAndPin()
Helper method to implement the Locker interface to support deadlock recognition via core.dr package |
void |
commit()
Commit this transaction. |
ObjectContainer |
copyObjectAndPin(ObjectID id)
|
ObjectContainer |
createObjectAndPin(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()
|
java.lang.Object |
getData()
|
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)
|
User |
owner()
|
boolean |
performCommand(DbCommand command)
|
void |
prepareCommit()
|
void |
releaseObjectAndUnpin(ObjectContainer objectContainer)
The corresponding method to acquireObjectAndPin(org.ozoneDB.core.ObjectID, int) . |
void |
reset()
|
protected void |
setData(java.lang.Object to)
|
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
private java.lang.Object data
protected int commandCount
protected ObjectID blocker
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 |
public Transaction(Env _env, User _owner)
_env
- Environment of this transaction._owner
- User that has started this transaction.public 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 releaseObjectAndUnpin(ObjectContainer objectContainer)
acquireObjectAndPin(org.ozoneDB.core.ObjectID, int)
.
public ObjectContainer acquireObjectAndPin(ObjectID id, int lockLevel) throws org.ozoneDB.ObjectNotFoundExc, java.io.IOException, java.lang.ClassNotFoundException, org.ozoneDB.TransactionExc, 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.ObjectNotFoundExc
- If there is no such object.
java.io.IOException
java.lang.ClassNotFoundException
org.ozoneDB.TransactionExc
TransactionError
protected ObjectContainer acquireContainer(ObjectContainer container, int lockLevel) throws PermissionError, org.ozoneDB.TransactionExc, TransactionError, java.io.IOException, org.ozoneDB.ObjectNotFoundExc, java.lang.ClassNotFoundException
PermissionError
org.ozoneDB.TransactionExc
TransactionError
java.io.IOException
org.ozoneDB.ObjectNotFoundExc
java.lang.ClassNotFoundException
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
protected void setData(java.lang.Object to)
public java.lang.Object getData()
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 blockedByAndPin()
blockedByAndPin
in interface Locker
public boolean isBlocked()
isBlocked
in interface Locker
public ObjectContainer createObjectAndPin(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.ExceptionInOzoneObjectException
className
- access
- name
- id
- The ID of the new container or null.
org.ozoneDB.PermissionDeniedExc
- If user in invalid, name is already in
use, target is not OzoneCompatible...
java.lang.Exception
org.ozoneDB.ExceptionInOzoneObjectException
public ObjectContainer copyObjectAndPin(ObjectID id) throws java.lang.Exception
java.lang.Exception
public void deleteObject(ObjectID id) throws org.ozoneDB.ObjectNotFoundExc, java.io.IOException, java.lang.ClassNotFoundException, org.ozoneDB.TransactionExc, TransactionError, org.ozoneDB.OzoneRemoteExc, org.ozoneDB.OzoneInternalExc, org.ozoneDB.ExceptionInOzoneObjectException
org.ozoneDB.ObjectNotFoundExc
java.io.IOException
java.lang.ClassNotFoundException
org.ozoneDB.TransactionExc
TransactionError
org.ozoneDB.OzoneRemoteExc
org.ozoneDB.OzoneInternalExc
org.ozoneDB.ExceptionInOzoneObjectException
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.ExceptionInOzoneObjectException
id
- methodName
- sig
- lockLevel
-
java.lang.Exception
org.ozoneDB.ExceptionInOzoneObjectException
public java.lang.Object invokeObject(ObjectID id, int methodIndex, java.lang.Object[] args, int lockLevel) throws java.lang.Exception, org.ozoneDB.ExceptionInOzoneObjectException
java.lang.Exception
org.ozoneDB.ExceptionInOzoneObjectException
public void nameObject(ObjectID id, java.lang.String name) 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)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
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 |