org.keridwen.core.messaging
Interface Supervisor<ReturnType>

Type Parameters:
ReturnType - The type of data returned by the supervised command.
All Superinterfaces:
Controllable, Progressable
All Known Implementing Classes:
DefaultSupervisor

public interface Supervisor<ReturnType>
extends Controllable, Progressable

A Supervisor allows to monitor and control a Command.


Method Summary
 ReturnType get()
          Waits if necessary for the computation to complete, and then retrieves its result.
 ReturnType get(long timeout, TimeUnit unit)
          Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
 String getCommandDescription()
          Returns the localized Command description.
 String getCommandLabel()
          Returns the localized Command name.
 void killCommand()
           
 
Methods inherited from interface org.keridwen.core.data.model.progress.Controllable
addControllableListener, clearControllableListener, getState, interrupt, isInterrupted, isInterruptible, isPausable, pause, removeControllableListener, resume
 
Methods inherited from interface org.keridwen.core.data.model.progress.Progressable
addProgressableListener, clearProgressableListener, getProgress, getState, isDetermined, removeProgressableListener
 

Method Detail

get

ReturnType get(long timeout,
               TimeUnit unit)
               throws InterruptedException,
                      ExecutionException,
                      TimeoutException
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
the computed result
Throws:
CancellationException - if the computation was cancelled
ExecutionException - if the computation threw an exception
InterruptedException - if the current thread was interrupted while waiting
TimeoutException - if the wait timed out

get

ReturnType get()
               throws InterruptedException,
                      ExecutionException
Waits if necessary for the computation to complete, and then retrieves its result.

Returns:
the computed result
Throws:
CancellationException - if the computation was cancelled
ExecutionException - if the computation threw an exception
InterruptedException - if the current thread was interrupted while waiting

getCommandLabel

String getCommandLabel()
Returns the localized Command name.

Returns:
the command name

getCommandDescription

String getCommandDescription()
Returns the localized Command description.

Returns:
the command description

killCommand

void killCommand()


Copyright © 2010-2013 Artenum. All Rights Reserved.