com.iparelan.util
Interface SuspendableTask

All Superinterfaces:
Runnable
All Known Implementing Classes:
PeriodicSuspendableThread

@Copyright(value="Copyright © 2008, Iparelan Solutions, LLC. All rights reserved.")
public interface SuspendableTask
extends Runnable

A task that can be paused and restarted.

To be suspendable, implementations must be written so that they either respond to the Thread interruption scheme or execute some periodic function that checks whether the task has been disabled. Under no circumstances should deprecated thread suspension schemes be used.

In addition to deprecated suspension features of Java threads, there are also new facilities in the java.util.concurrent package for scheduling repeating tasks, but these facilities do not appear to support suspension.

Version:
July 2008
Author:
Greg Mattes
See Also:
Java Thread Primitive Deprecation, ScheduledExecutorService, ScheduledFuture

Method Summary
 void disable()
          "Turns-off" this task.
 void enable()
          "Turns-on" this task.
 boolean isEnabled()
          Tells whether this task is enabled.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

enable

void enable()
"Turns-on" this task. Calling this method is not guaranteed to commence task execution. Calling disable() before task execution begins may stop task execution.


disable

void disable()
"Turns-off" this task.

The task may not be turned off immediately if it does not respond to the thread interruption scheme, or if it is not blocked.


isEnabled

boolean isEnabled()
Tells whether this task is enabled.

Returns:
true if this task is enabled, otherwise false.


Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.