net.sf.seide.core.impl
Class DispatcherImpl

java.lang.Object
  extended by net.sf.seide.core.impl.DispatcherImpl
All Implemented Interfaces:
Dispatcher, DispatcherStatistics, Lifecycle

public class DispatcherImpl
extends Object
implements Dispatcher, DispatcherStatistics

The main Dispatcher implementation.

Author:
german.kondolf

Constructor Summary
DispatcherImpl()
           
 
Method Summary
 boolean execute(Event event)
          Routes the Event to the specified Stage executing the associated EventHandler.
 boolean execute(String stage, Message message)
          Routes the Message to the specified Stage executing the associated EventHandler.
 String getContext()
           
 int getStageCount()
           
 long getTotalEventExecutionsCount()
           
 boolean isRunning()
           
 boolean isThrowExceptionOnInvalidStage()
           
 void setContext(String context)
          This parameter sets a context, to allow different flows running at the same time and it is propagated in logs & JXM metrics.
 void setStages(List<Stage> stages)
          Stage list of supported flow EventHandler.
 void setThrowExceptionOnInvalidStage(boolean throwExceptionOnInvalidStage)
           
 void start()
          Starts the object implementation's lifecycle.
 void stop()
          Stops the object implementation's lifecycle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispatcherImpl

public DispatcherImpl()
Method Detail

execute

public boolean execute(String stage,
                       Message message)
                throws InvalidStageException
Description copied from interface: Dispatcher
Routes the Message to the specified Stage executing the associated EventHandler.

Specified by:
execute in interface Dispatcher
Parameters:
stage - Stage.id
message - payload.
Throws:
InvalidStageException

execute

public boolean execute(Event event)
                throws InvalidStageException
Description copied from interface: Dispatcher
Routes the Event to the specified Stage executing the associated EventHandler.

Specified by:
execute in interface Dispatcher
Throws:
InvalidStageException

start

public void start()
Description copied from interface: Lifecycle
Starts the object implementation's lifecycle.

Specified by:
start in interface Lifecycle

getContext

public String getContext()
Specified by:
getContext in interface Dispatcher
Returns:
The dispatcher context identifier.

setContext

public void setContext(String context)
Description copied from interface: Dispatcher
This parameter sets a context, to allow different flows running at the same time and it is propagated in logs & JXM metrics.

Specified by:
setContext in interface Dispatcher

setStages

public void setStages(List<Stage> stages)
Description copied from interface: Dispatcher
Stage list of supported flow EventHandler.

Specified by:
setStages in interface Dispatcher
Parameters:
stages - Stage list.

setThrowExceptionOnInvalidStage

public void setThrowExceptionOnInvalidStage(boolean throwExceptionOnInvalidStage)

isThrowExceptionOnInvalidStage

public boolean isThrowExceptionOnInvalidStage()

stop

public void stop()
Description copied from interface: Lifecycle
Stops the object implementation's lifecycle.

Specified by:
stop in interface Lifecycle

isRunning

public boolean isRunning()
Specified by:
isRunning in interface Lifecycle
Returns:
is the daemon running now?

getStageCount

public int getStageCount()
Specified by:
getStageCount in interface DispatcherStatistics
Returns:
# of stages defined in the given dispatcher.

getTotalEventExecutionsCount

public long getTotalEventExecutionsCount()
Specified by:
getTotalEventExecutionsCount in interface DispatcherStatistics
Returns:
# of total executions since the Lifecycle.start() call.


Copyright © 2011. All Rights Reserved.