net.sourceforge.acelogger.execution.task
Class CancelableTask

java.lang.Object
  extended by net.sourceforge.acelogger.execution.task.CancelableTask
All Implemented Interfaces:
Runnable

public class CancelableTask
extends Object
implements Runnable

A Runnable implementation and a wrapper that supports canceling it's task execution.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Constructor Summary
CancelableTask(Runnable task)
          Constructs a new CancelableTask for the given task.
 
Method Summary
 Boolean cancel()
          Try to cancel the task execution.
 Boolean hasAlreadyRun()
          Indicates that the task has already run.
 void run()
          
 Boolean shouldRun()
          Indicates that the task should run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CancelableTask

public CancelableTask(Runnable task)
Constructs a new CancelableTask for the given task.

Parameters:
task - The task to be monitored.
Since:
1.0.0
Method Detail

run

public void run()

Specified by:
run in interface Runnable

hasAlreadyRun

public Boolean hasAlreadyRun()
Indicates that the task has already run.

Returns:
True if the task has already run; False otherwise (it is waiting execution or was canceled).
Since:
1.0.0

shouldRun

public Boolean shouldRun()
Indicates that the task should run.

Returns:
True if the task should run; False otherwise (it was canceled).
Since:
1.0.0

cancel

public Boolean cancel()
Try to cancel the task execution. If a task has already run or is running, there's no way to cancel it.

Returns:
True if the task was canceled, that means the task has not yet run nor is running and will never run. False if there's no guaranteed way to cancel it anymore.
Since:
1.0.0


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.