JADE Java Persistence API
1.0

com.jadeworld.jade.rootschema
Class Lock

java.lang.Object
  extended by com.jadeworld.jade.rootschema.Object
      extended by com.jadeworld.jade.rootschema.Lock

public class Lock
extends Object

Instances of the Lock class are used to describe the locks and lock requests maintained by the JADE system.


Field Summary
 
Fields inherited from class com.jadeworld.jade.rootschema.Object
oid
 
Constructor Summary
Lock()
           
 
Method Summary
 char duration()
          The read-only duration property of the Lock class is set to the value of the duration parameter of the lock request.
 java.util.Calendar elapsedTime()
          The read-only elapsedTime property of the Lock class is set to the time that the lock request has been in place.
 char kind()
          The read-only kind property of the Lock class is set to the kind of node lock for stable objects.
 Process lockedBy()
          The read-only lockedBy property of the Lock class is a read-only property that is set to the process that currently holds a lock on the target object of the lock.
 Process requestedBy()
          The read-only requestedBy property of the Lock class is a read-only property that is set to the process that submitted the lock request.
 java.util.Calendar requestTime()
          The read-only requestTime property of the Lock class is set to the date and time of the lock request.
 Object target()
          Used to get a reference to the object that is the target of a lock request.
 char type()
          The read-only type property of the Lock class is set to the value of the type parameter of the lock request.
 java.util.Calendar waitTime()
          The read-only waitTime property of the Lock class is set to the timeout parameter of the lock request.
 
Methods inherited from class com.jadeworld.jade.rootschema.Object
changeObjectVolatility, creationTime, edition, equals, exclusiveLock, getClassNumberForObject, getInstanceIdForObject, getLockStatus, getName, getObjectStringForObject, getObjectVolatility, getOidString, getOidStringForObject, getPropertyValue, hashCode, hasMembers, isImportedObject, isKindOf, isLockedByMe, isObjectFrozen, isObjectNonSharedTransient, isObjectPersistent, isObjectSharedTransient, isObjectStable, isObjectTransient, isObjectVolatile, isSharedTransient, isSystemObject, isTransient, latestEdition, lock, makeObjectFrozen, makeObjectStable, makeObjectVolatile, reserveLock, sdeCauseEvent, sdsCauseEvent, setPropertyValue, sharedLock, toString, tryLock, unlock, updateObjectEdition
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Lock

public Lock()
Method Detail

duration

public char duration()
The read-only duration property of the Lock class is set to the value of the duration parameter of the lock request.

The duration parameter of the lock request specifies if the object is automatically unlocked at the end of transaction time or at the end of the current session (that is, the current thread, or process).

If a manual unlock is issued, the object is unlocked only if you are not in transaction or load state. In persistent transaction state, all unlock requests for persistent objects are ignored. Similarly, in transient transaction state, all unlock requests for shared transient objects are ignored. A session lock is therefore not released if the unlock request is made while in transaction state. To release a session lock, the unlock request must be made while not in transaction state.

The character values correspond to the Transaction_Duration and Session_Duration global constants in the LockDurations category, respectively.

Returns:
The duration value for the lock instance.

elapsedTime

public java.util.Calendar elapsedTime()
The read-only elapsedTime property of the Lock class is set to the time that the lock request has been in place.

For a queued lock entry, this is the time that the request has been waiting. (If you want to obtain the total length of time from the first attempt to obtain the lock up to the time it times out, use the Lock class waitTime property.)

Returns:
The elapsed time property.

kind

public char kind()
The read-only kind property of the Lock class is set to the kind of node lock for stable objects. (For details, see Stable Objects under Cache Concurrency, in Chapter 9 of your JADE Developer's Reference.)

The character values correspond to the Lock class constants listed in the following table.p>

 Constant Character Value Description
Kind_Local '01' Applies to stable objects and represents a shared, transient duration lock that has an associated node lock (Kind_Node) entry in the database server lock tables. There is no individual lock entry for the process in the database server lock tables (unless the process is a server application).
Kind _Node '02' Applies to stable objects and represents a shared, transient duration lock that may be held by one or more processes on the node associated with the node lock. The associated background process of the node is used as the locking process. A node lock is released when an exclusive lock request is received or the object is removed from the nodes cache and there are no processes on the associated node that have the object locked with local locks.
Kind_Normal '00' Represents a lock held by a process. It is released when the process unlocks the object. Kind_Local locks are present only on the local node on which the lock request was issued.

You can use the lockedBy property to determine the node associated with a Kind_Node, as it contains a reference to the background process of the associated node.

Returns:
the kind property value.

lockedBy

public Process lockedBy()
The read-only lockedBy property of the Lock class is a read-only property that is set to the process that currently holds a lock on the target object of the lock. If the lock request is not waiting in the locks queue, this reference is set to null.

Returns:
The lockedBy property.

requestTime

public java.util.Calendar requestTime()
The read-only requestTime property of the Lock class is set to the date and time of the lock request.

Returns:
The requestTime property value.

requestedBy

public Process requestedBy()
The read-only requestedBy property of the Lock class is a read-only property that is set to the process that submitted the lock request.

Returns:
The requestedBy property value.

target

public Object target()
Used to get a reference to the object that is the target of a lock request.

Returns:
The target of the lock.

type

public char type()
The read-only type property of the Lock class is set to the value of the type parameter of the lock request. The character values correspond to the Share_Lock, Reserve_Lock and Exclusive_Lock global constant in the Locks category.

Returns:
The type property value.

waitTime

public java.util.Calendar waitTime()
The read-only waitTime property of the Lock class is set to the timeout parameter of the lock request. This property specifies the total length of time the lock request waits from the time it first attempted to get the lock until a lock exception is reported back if the object is currently locked by another user.

If you want to obtain the length of time the lock request has been in place, use the Lock class elapsedTime property.

Returns:
The wait time property value.

JADE Java Persistence API
1.0

Copyright © 2007 Jade Software Corporation