|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.keridwen.core.messaging.internal.DefaultSupervisor<ReturnType>
ReturnType
- the type of object returned by the command.public class DefaultSupervisor<ReturnType>
A DefaultSupervisor
controls and monitors a Command
.
Constructor Summary | |
---|---|
DefaultSupervisor(Future<ReturnType> aFuture,
Command<ReturnType,?> aCommand)
Builds a command Supervisor for the given command. |
Method Summary | |
---|---|
void |
addControllableListener(ControllableListener listener)
|
void |
addProgressableListener(ProgressableListener listener)
|
void |
clearControllableListener()
|
void |
clearProgressableListener()
|
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. |
int |
getProgress()
|
ControllableState |
getState()
|
void |
interrupt()
|
boolean |
isDetermined()
|
boolean |
isInterrupted()
|
boolean |
isInterruptible()
|
boolean |
isPausable()
|
void |
killCommand()
|
void |
pause()
|
void |
removeControllableListener(ControllableListener listener)
|
void |
removeProgressableListener(ProgressableListener listener)
|
void |
resume()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultSupervisor(Future<ReturnType> aFuture, Command<ReturnType,?> aCommand)
Supervisor
for the given command.
aFuture
- the future to controlaCommand
- the command to monitor.Method Detail |
---|
public final ReturnType get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
Supervisor
get
in interface Supervisor<ReturnType>
timeout
- the maximum time to waitunit
- the time unit of the timeout argument
InterruptedException
- if the current thread was interrupted while waiting
ExecutionException
- if the computation threw an exception
TimeoutException
- if the wait timed outpublic final ReturnType get() throws InterruptedException, ExecutionException
Supervisor
get
in interface Supervisor<ReturnType>
InterruptedException
- if the current thread was interrupted while waiting
ExecutionException
- if the computation threw an exceptionpublic final int getProgress()
getProgress
in interface Progressable
public final ControllableState getState()
getState
in interface Controllable
getState
in interface Progressable
public final String getCommandLabel()
Supervisor
Command
name.
getCommandLabel
in interface Supervisor<ReturnType>
public final String getCommandDescription()
Supervisor
Command
description.
getCommandDescription
in interface Supervisor<ReturnType>
public final void interrupt()
interrupt
in interface Controllable
public final void pause()
pause
in interface Controllable
public final void resume()
resume
in interface Controllable
public final boolean isInterrupted()
isInterrupted
in interface Controllable
public final boolean isInterruptible()
isInterruptible
in interface Controllable
public final void addProgressableListener(ProgressableListener listener)
addProgressableListener
in interface Progressable
public final void removeProgressableListener(ProgressableListener listener)
removeProgressableListener
in interface Progressable
public final boolean isPausable()
isPausable
in interface Controllable
public final void addControllableListener(ControllableListener listener)
addControllableListener
in interface Controllable
public final void removeControllableListener(ControllableListener listener)
removeControllableListener
in interface Controllable
public final void clearControllableListener()
clearControllableListener
in interface Controllable
public final boolean isDetermined()
isDetermined
in interface Progressable
public final void clearProgressableListener()
clearProgressableListener
in interface Progressable
public void killCommand()
killCommand
in interface Supervisor<ReturnType>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |