Class DelayedTask

java.lang.Object
  extended by DelayedTask
All Implemented Interfaces:
java.lang.Comparable<java.util.concurrent.Delayed>, java.lang.Runnable, java.util.concurrent.Delayed

public class DelayedTask
extends java.lang.Object
implements java.lang.Runnable, java.util.concurrent.Delayed

DelayedTask - Lets you add a task to a j.u.concurrent.DelayQueue


Method Summary
Modifier and Type Method and Description
 int compareTo(java.util.concurrent.Delayed delayed)
          Compares order of two DelayedTasks
 long getDelay(java.util.concurrent.TimeUnit unit)
          Returns how long this task needs to be delayed
 void run()
          Runs the embedded task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

public void run()
Runs the embedded task

Specified by:
run in interface java.lang.Runnable

getDelay

public long getDelay(java.util.concurrent.TimeUnit unit)
Returns how long this task needs to be delayed

Specified by:
getDelay in interface java.util.concurrent.Delayed
Parameters:
unit - the TimeUnit of the result

compareTo

public int compareTo(java.util.concurrent.Delayed delayed)
Compares order of two DelayedTasks

Specified by:
compareTo in interface java.lang.Comparable<java.util.concurrent.Delayed>
Parameters:
delayed - the other object to compare to