|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.common.core.utils.handlers.GCUBEHandler<HANDLED>
org.gcube.common.core.utils.handlers.GCUBEComplexHandler<HANDLED>
org.gcube.common.core.utils.handlers.GCUBEParallelHandler<HANDLED>
HANDLED - the type of the handled object of the component handlers.public class GCUBEParallelHandler<HANDLED>
An extension of 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.
| Nested Class Summary | |
|---|---|
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(). |
| Field Summary | |
|---|---|
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. |
| Fields inherited from class org.gcube.common.core.utils.handlers.GCUBEHandler |
|---|
handled, logger, producer |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEComplexHandler |
|---|
addHandlers, getHandlers, removeHandler, setLogger, undo |
| Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEHandler |
|---|
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, getState, notify, setBlackboard, setHandled, setName, setScopeManager, setSecurityManager, setState, subscribe, unsubscribe |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.gcube.common.core.utils.handlers.lifetime.Lifetime |
|---|
getState |
| Methods inherited from interface org.gcube.common.core.utils.handlers.GCUBEIHandler |
|---|
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, setBlackboard, setHandled, setLogger, setName, setScopeManager, setSecurityManager, subscribe, undo, unsubscribe |
| Field Detail |
|---|
protected GCUBEParallelHandler.Mode mode
protected List<GCUBEParallelHandler.SlaveThread> failedSlaves
protected List<GCUBEParallelHandler.SlaveThread> runningSlaves
protected Map<GCUBEIHandler<? extends HANDLED>,Exception> failedHandlers
| Constructor Detail |
|---|
public GCUBEParallelHandler(GCUBEIHandler<? extends HANDLED>... components)
components - the component handlers.public GCUBEParallelHandler(GCUBEParallelHandler.Mode mode)
mode - the failure handling mode.| Method Detail |
|---|
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||