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
Name | Description | |
---|---|---|
Lock..::..With | Constructs an executor that will grab the named lock. |
Methods
Name | Description | |
---|---|---|
DoBody | Code to execute with exclusive access. | |
Equals | (Inherited from Object.) | |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
run | 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.
| |
ToString | (Inherited from Object.) |