Groovy Documentation

griffon.plugins.tasks
[Java] Interface Task


public interface Task

A long-running task.

The contract is this of UIThreadWorker with the difference that in case of an execution exception the failed(Throwable) method is invoked and done(Object) is not.

Authors:
Eike Kettner
Since:
19.07.11 22:13


Nested Class Summary
enum Task.Mode

@author Eike Kettner

enum Task.State

@author Eike Kettner

 
Method Summary
void done(Object value)

This method is invoked once execute(Tracker) has successfully finished and is called on the UI thread.

Object execute(Tracker tracker)

This method implements the long-running work and returns a result.

void failed(Throwable cause)

This method is invoked if execute(Tracker) threw an exception.

String getId()

A id that identifies this task (or a group of tasks).

Task.Mode getMode()

void process(List chunks)

Calls going to Tracker.publish from within execute(Tracker) are routed to this method.

Task valueOf(String name)

Returns the enum constant of this type with the specified name.

Task valueOf(String name)

Returns the enum constant of this type with the specified name.

Task[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

Task[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

 

Method Detail

done

public void done(Object value)
This method is invoked once execute(Tracker) has successfully finished and is called on the UI thread.
Parameters:
value


execute

public Object execute(Tracker tracker)
This method implements the long-running work and returns a result. This method is invoked on a worker thread.
Parameters:
tracker - to publish intermediate results
Returns:
@throws Exception


failed

public void failed(Throwable cause)
This method is invoked if execute(Tracker) threw an exception. This method is executed on the UI thread.
Parameters:
cause


getId

public String getId()
A id that identifies this task (or a group of tasks). This doesn't have to be unique among all tasks. It's used to register TaskListener on this id that will receive events solely for tasks with a certain id.
Returns:


getMode

public Task.Mode getMode()


process

public void process(List chunks)
Calls going to Tracker.publish from within execute(Tracker) are routed to this method. This method is invoked on the UI thread.
Parameters:
chunks


valueOf

Task valueOf(String name)
Returns the enum constant of this type with the specified name.


valueOf

Task valueOf(String name)
Returns the enum constant of this type with the specified name.


values

Task[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


values

Task[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


 

Groovy Documentation