An interprocess mutex lock.

Typical use might look like:

            new Lock.With(directory.makeLock("my.lock")) {
            public Object doBody() {
            ... code to execute while locked ...
            }
            }.run();
            

The Lock..::..With type exposes the following members.

Constructors

  NameDescription
Public methodLock..::..With
Constructs an executor that will grab the named lock.

Methods

  NameDescription
Protected methodDoBody
Code to execute with exclusive access.
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.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodrun
Calls {@link #doBody} while lock is obtained. Blocks if lock cannot be obtained immediately. Retries to obtain lock once per second until it is obtained, or until it has tried ten times. Lock is released when {@link #doBody} exits.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

See Also