LockType
- the type of lockpublic class LockGrantFuture<LockType> extends Object implements Future<LockGrant<LockType>>
Future representing a request for a lock grant. This future object is
created when requesting a lock on a target. A LockGrantFuture
is
an asynchronous request for a lock grant. A synchronous wait can be done
invoking the get()
or the get(long, TimeUnit)
methods.
Lock grant futures can be cancelled. Cancelling a lock grant future will release any partial locks already acquired. It will not release the lock if it has already been acquired.
Synchronization locks on LockGrantFuture
should never be
made outside locklib
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
LockGrant<LockType> |
get() |
LockGrant<LockType> |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
LockRequest<LockType> |
request()
Obtains the lock request.
|
Target<LockType> |
target()
Obtains the target of the lock.
|
String |
toString() |
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<LockGrant<LockType>>
public LockGrant<LockType> get() throws InterruptedException, ExecutionException
get
in interface Future<LockGrant<LockType>>
InterruptedException
ExecutionException
public LockGrant<LockType> get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<LockGrant<LockType>>
InterruptedException
ExecutionException
TimeoutException
public LockRequest<LockType> request()
Copyright © 2015. All rights reserved.