The Lock type exposes the following members.

Constructors

  NameDescription
Protected methodLock
Initializes a new instance of the Lock class

Methods

  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsLocked
Returns true if the resource is currently locked. Note that one must still call {@link #Obtain()} before using the resource.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodObtain()()()()
Attempts to obtain exclusive access and immediately return upon success or failure.
Public methodObtain(Int64)
Attempts to obtain an exclusive lock within amount of time given. Polls once per {@link #LOCK_POLL_INTERVAL} (currently 1000) milliseconds until lockWaitTimeout is passed.
Public methodRelease
Releases exclusive access.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

Fields

  NameDescription
Protected fieldfailureReason
If a lock obtain called, this failureReason may be set with the "root cause" Exception as to why the lock was not obtained.
Public fieldStatic memberLOCK_OBTAIN_WAIT_FOREVER
Pass this value to {@link #Obtain(long)} to try forever to obtain the lock.
Public fieldStatic memberLOCK_POLL_INTERVAL
How long {@link #Obtain(long)} waits, in milliseconds, in between attempts to acquire the lock.

See Also