com.bigdata.concurrent
Class NonBlockingLockManagerWithNewDesign.LockFutureTask<R extends Comparable<R>,T>

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

public static class NonBlockingLockManagerWithNewDesign.LockFutureTask<R extends Comparable<R>,T>
extends FutureTaskMon<T>

FutureTask which executes once it holds its locks.

Version:
$Id: NonBlockingLockManagerWithNewDesign.java 5809 2011-12-19 16:56:48Z thompsonbry $
Author:
Bryan Thompson

Method Summary
protected  NonBlockingLockManagerWithNewDesign.LockFutureTask<R,T> acceptTask()
          Accept the task for eventual execution.
 boolean cancel(boolean mayInterruptIfRunning)
          Note: We do not need to remove the task from the readyQueue when it is cancelled.
 long getLockLatency()
          The elapsed nanoseconds the task waited to acquire its locks.
 R[] getResource()
          The resource(s) that are pre-declared by the task.
 boolean isLocksHeld()
          Return true iff the task holds all its locks.
 void run()
          
protected  void setException(Throwable t)
          Note: We do not need to remove the task from the readyQueue when it an exception is set on it.
 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
 

Method Detail

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.


toString

public String toString()
Overrides:
toString in class Object

acceptTask

protected NonBlockingLockManagerWithNewDesign.LockFutureTask<R,T> acceptTask()
Accept the task for eventual execution.


isLocksHeld

public boolean isLocksHeld()
Return true iff the task holds all its locks.


setException

protected void setException(Throwable t)
Note: We do not need to remove the task from the readyQueue when it an exception is set on it. When the task is pulled from the queue by an executor service, the task will be marked as cancelled and its run() method will be a NOP.

Overrides:
setException in class FutureTask<T>

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Note: We do not need to remove the task from the readyQueue when it is cancelled. When the task is pulled from the queue by an executor service, the task will be marked as cancelled and its run() method will be a NOP.

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

run

public void run()
Description copied from class: FutureTaskMon

Hooked to notice when the task has been started.

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.