com.bigdata.concurrent
Class NonBlockingLockManager.LockFutureTask<T>

java.lang.Object
  extended by java.util.concurrent.FutureTask<T>
      extended by com.bigdata.concurrent.FutureTaskMon<T>
          extended by com.bigdata.concurrent.NonBlockingLockManager.LockFutureTask<T>
Type Parameters:
T - The generic type of the outcome for the Future.
All Implemented Interfaces:
Runnable, Future<T>, RunnableFuture<T>
Enclosing class:
NonBlockingLockManager<R extends Comparable<R>>

protected class NonBlockingLockManager.LockFutureTask<T>
extends FutureTaskMon<T>

FutureTask which executes once it holds its locks.

Version:
$Id: NonBlockingLockManager.java 4280 2011-03-08 15:06:58Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
NonBlockingLockManager.LockFutureTask(R[] resource, Callable<T> task, long timeout, int maxLockTries)
           
NonBlockingLockManager.LockFutureTask(R[] resources, Runnable task, T val, long timeout, int maxLockTries)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          Extended signal NonBlockingLockManager.stateChanged when the task completes and to track counters.
 long getLockLatency()
          The elapsed nanoseconds the task waited to acquire its locks.
 long getLockTimeout()
          The timeout (milliseconds) or ZERO (0L) for an infinite timeout.
 int getMaxLockTries()
          The maximum #of times that the task will attempt to acquire its locks (positive integer).
 R[] getResource()
          The resource(s) that are pre-declared by the task.
protected  boolean isTimeout()
          True if the lockTimeout has expired when measured against now.
 void run()
          Extended signal NonBlockingLockManager.stateChanged when the task completes and to track counters.
protected  void setException(Throwable t)
          Extended signal NonBlockingLockManager.stateChanged when the task completes, to track counters, and also exposed to the outer class.
 String toString()
           
 
Methods inherited from class java.util.concurrent.FutureTask
done, get, get, isCancelled, isDone, runAndReset, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonBlockingLockManager.LockFutureTask

public NonBlockingLockManager.LockFutureTask(R[] resource,
                                             Callable<T> task,
                                             long timeout,
                                             int maxLockTries)

NonBlockingLockManager.LockFutureTask

public NonBlockingLockManager.LockFutureTask(R[] resources,
                                             Runnable task,
                                             T val,
                                             long timeout,
                                             int maxLockTries)
Method Detail

isTimeout

protected boolean isTimeout()
True if the lockTimeout has expired when measured against now.


toString

public String toString()
Overrides:
toString in class Object

getResource

public R[] getResource()
The resource(s) that are pre-declared by the task. #call() will ensure that the task as a lock on these resources before it invokes run() to execution the task.


getLockLatency

public long getLockLatency()
The elapsed nanoseconds the task waited to acquire its locks.


getMaxLockTries

public int getMaxLockTries()
The maximum #of times that the task will attempt to acquire its locks (positive integer).


getLockTimeout

public long getLockTimeout()
The timeout (milliseconds) or ZERO (0L) for an infinite timeout.


setException

protected void setException(Throwable t)
Extended signal NonBlockingLockManager.stateChanged when the task completes, to track counters, and also exposed to the outer class.

Overrides:
setException in class FutureTask<T>

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Extended signal NonBlockingLockManager.stateChanged when the task completes and to track counters.

Specified by:
cancel in interface Future<T>
Overrides:
cancel in class FutureTaskMon<T>

run

public void run()
Extended signal NonBlockingLockManager.stateChanged when the task completes and to track counters.

Specified by:
run in interface Runnable
Specified by:
run in interface RunnableFuture<T>
Overrides:
run in class FutureTaskMon<T>


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.