com.hammurapi.flow.runtime.impl
Class DefaultSynapse<S,A>

java.lang.Object
  extended by com.hammurapi.flow.runtime.impl.DefaultSynapse<S,A>
Type Parameters:
S - Flow state type.
A - Argument type.
All Implemented Interfaces:
Invocable<S,A>

public class DefaultSynapse<S,A>
extends Object
implements Invocable<S,A>

Default synapse implementation.

Author:
Pavel Vlasov

Field Summary
static int DEFAULT_MAX_PATH
           
static int DEFAULT_MAX_REENTRANCE
           
 
Constructor Summary
DefaultSynapse(Invocable<S,A> invocable, ProcessingPathElement processingPathElement)
          Constructors
 
Method Summary
 int getMaxPath()
           
 int getMaxReentrance()
           
 Collection<Future<?>> invoke(S flowState, A[] args, PropertySet properties, Context context, List<ProcessingPathElement> processingPath)
          Checks processing path length and this processing element reentrance count.
 void setMaxPath(int maxPath)
           
 void setMaxReentrance(int maxReentrance)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_PATH

public static int DEFAULT_MAX_PATH

DEFAULT_MAX_REENTRANCE

public static int DEFAULT_MAX_REENTRANCE
Constructor Detail

DefaultSynapse

public DefaultSynapse(Invocable<S,A> invocable,
                      ProcessingPathElement processingPathElement)
Constructors

Parameters:
invocable - Target invocable.
processingPathElement - Processing path element for given point in the flow.
Method Detail

getMaxPath

public int getMaxPath()

setMaxPath

public void setMaxPath(int maxPath)

getMaxReentrance

public int getMaxReentrance()

setMaxReentrance

public void setMaxReentrance(int maxReentrance)

invoke

public Collection<Future<?>> invoke(S flowState,
                                    A[] args,
                                    PropertySet properties,
                                    Context context,
                                    List<ProcessingPathElement> processingPath)
                             throws Exception
Checks processing path length and this processing element reentrance count. Throws exception if any of these numbers exceeds specified limit. Then adds this processing path element to the processing path and invokes target invocable in the current thread.

Specified by:
invoke in interface Invocable<S,A>
Throws:
Exception