net.sf.asyncobjects.util
Class Seq<R>
java.lang.Object
net.sf.asyncobjects.util.RunDispatcher
net.sf.asyncobjects.util.Seq<R>
- Type Parameters:
R
- A result type
- All Implemented Interfaces:
- ExplicitSharing
public abstract class Seq<R>
- extends RunDispatcher
A sequence control construct. This construct ensures that next actions is
executed only if previous finished one way or another. If one of actions
fails, next are not executed. Seq is sequeduled to be executed on some later
turn because it reuses when construct. This also means that constructor
completes before construct is executed. The control construct attempts to
execute as much as possible in the single turn.
- Author:
- const
Constructor Summary |
protected |
Seq()
A constructor. |
Methods inherited from class net.sf.asyncobjects.util.RunDispatcher |
run1, run10, run11, run12, run13, run14, run15, run16, run2, run3, run4, run5, run6, run7, run8, run9, runNext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Seq
protected Seq()
- A constructor. Constructors schedule execution of this seq construct.
smashed
protected Promise<R> smashed(int action,
Throwable problem)
throws Throwable
- Handle fault on one of actions. By default just fail.
- Parameters:
action
- action numberproblem
- a problem
- Returns:
- a result to be returned
- Throws:
Throwable
- a problem that is used to smash result promise.
finallyDo
protected Promise<?> finallyDo()
throws Throwable
- This method is executed when all actions are finished. The method does
not affect return value, however it can generate a fault that will be
reflected in execution result.
- Returns:
- a promise or null which means that there is no finally action
- Throws:
Throwable
- that will be result of Seq
promise
public Promise<R> promise()
- Returns:
- a promise for this sequence of actions
Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.