HANDLED - the type of the handled object of the component handlers.public class GCUBEParallelHandler<HANDLED> extends GCUBEComplexHandler<HANDLED> implements Lifetime<HANDLED>
GCUBEComplexHandler which parallelises the execution of
the component handlers. A GCUBEParallelHandler propagates
its state to all the component handlers (non-destructively).
Failures are handled in accordance with either one of the two modes
enumerated by GCUBEParallelHandler.Mode.| Modifier and Type | Class and Description |
|---|---|
static class |
GCUBEParallelHandler.Mode
Enumeration of the two failure handling modes of a
GCUBEParallelHandler. |
protected class |
GCUBEParallelHandler.SlaveThread
An extension of
Thread which executes a component handler and records its potential errors. |
protected class |
GCUBEParallelHandler.SweeperThread
An extension of
Thread which waits for all component handlers to terminate
before invoking GCUBEComplexHandler.undo(). |
| Modifier and Type | Field and Description |
|---|---|
protected Map<GCUBEIHandler<? extends HANDLED>,Exception> |
failedHandlers
Component handlers which have failed during the execution of the handler.
|
protected List<GCUBEParallelHandler.SlaveThread> |
failedSlaves
Per-component handler threads which have failed during the execution of the handler.
|
protected GCUBEParallelHandler.Mode |
mode
Failure mode for the execution of the handler.
|
protected List<GCUBEParallelHandler.SlaveThread> |
runningSlaves
Per-component handler threads spawned by the handler.
|
handled, logger, producer| Constructor and Description |
|---|
GCUBEParallelHandler(GCUBEIHandler<? extends HANDLED>... components)
Creates an instance with a list of component handlers.
|
GCUBEParallelHandler(GCUBEParallelHandler.Mode mode)
Creates an handler with a given failure handling mode.
|
| Modifier and Type | Method and Description |
|---|---|
Map<GCUBEIHandler<? extends HANDLED>,Exception> |
getFailedHandlers()
Returns the component handlers which have failed during execution of the handler, along with the
corresponding failures.
|
GCUBEParallelHandler.Mode |
getMode()
Returns the failure handling mode of the handler.
|
void |
run()
Executes the task implemented by the handler.
|
void |
setMode(GCUBEParallelHandler.Mode mode)
Sets the failure handling mode of the handler.
|
addHandlers, getHandlers, removeHandler, setLogger, undoclearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, getState, notify, setBlackboard, setHandled, setName, setScopeManager, setSecurityManager, setState, subscribe, unsubscribeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, setBlackboard, setHandled, setLogger, setName, setScopeManager, setSecurityManager, subscribe, undo, unsubscribeprotected GCUBEParallelHandler.Mode mode
protected List<GCUBEParallelHandler.SlaveThread> failedSlaves
protected List<GCUBEParallelHandler.SlaveThread> runningSlaves
protected Map<GCUBEIHandler<? extends HANDLED>,Exception> failedHandlers
public GCUBEParallelHandler(GCUBEIHandler<? extends HANDLED>... components)
components - the component handlers.public GCUBEParallelHandler(GCUBEParallelHandler.Mode mode)
mode - the failure handling mode.public GCUBEParallelHandler.Mode getMode()
public void setMode(GCUBEParallelHandler.Mode mode)
mode - the mode.public Map<GCUBEIHandler<? extends HANDLED>,Exception> getFailedHandlers()
public void run()
throws Exception
run in interface GCUBEIHandler<HANDLED>run in class GCUBEHandler<HANDLED>Exception - if the execution of the task does not complete normally.Copyright © 2015. All Rights Reserved.