com.samskivert.swing.util
Interface Task

All Known Implementing Classes:
TaskAdapter, TaskMaster.MethodTask

public interface Task

A swing application requests that a task be invoked by the task master. The task master invokes the task on a separate thread and informs the swing application when the task has completed via the task observer interface. It does so in a way that plays nicely with the swing event dispatch thread (the swing application is notified of the task's completion on the event dispatch thread so that it can wiggle its user interface elements to its heart's desire).


Method Summary
 boolean abort()
          This method is called by the task master when it has received a request to cancel this task.
 Object invoke()
          This method is called by the task master to invoke the task.
 

Method Detail

invoke

Object invoke()
              throws Exception
This method is called by the task master to invoke the task. The task should run to completion and return some value.

Throws:
Exception

abort

boolean abort()
This method is called by the task master when it has received a request to cancel this task. If the task can be cancelled, abort should return true and the currently running call to invoke() should immediately return (the return value will be ignored). If the task cannot be cancelled, abort should return false and the task master will simply abandon the task and the thread on which it is running.



Copyright © 2000-2008 Michael Bayne. All Rights Reserved.