Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.processor.threepass
Class ThreePassProcessor
com.newstep.solid.management.runtime.AsyncManagedExecutable
  |
  +--com.newstep.solid.processor.threepass.ThreePassProcessor
All Implemented Interfaces:
       ManagedExecutable, Processor, ThreePassProcessorPoolListener

public class ThreePassProcessor      
ThreePassProcessor is the main implementation of the MessageProcessor.
It provides is the main entry point into the processing system.
Messages are passed to the processor via the process() method.
The three pass processor decouples the decoding of Messages into Events from the processing of the Events.
This decoupling allows the processing to be scalled independently for each of the tasks.
The processing framework splits the message processing into three distinct phases:
i) message decoding and handler lookup for resulting events
ii) dispatching of events into handler
iii) processing of event by the handler

The ThreePassProcessor can be configured such that it guarantees the message
(and event) processing order is maintained.
That is, events arrive in the handler in the same order the that their
associated messages were placed in the processor.

Similarly, the processor framework contains abstractions that allow
event handlers to process events either in parallel or sequentially.
That is, handlers may be created either to allow multiple threads to process
different events with the same handler instance simultaneously OR
to guarantee that only a single thread has access to a handler
instance at a time.

In addition, the framework is designed not to block threads in cases
where their target handler is in use allowing them to drop back to the available pool.

The processing subsystem is designed as an extention to the core Java 1.5 concurrency package facilities.
In order to implement its functionality the ThreePassProcessor leverages the Java 1.5 concurrency Executor concept.
As such, three executors are maintained (one for each phase of processing).
Thus the number of threads associated with each phase can be tuned.
In order to keep the order of the processing consistent across phases,
the processor places a Future returned from one phase to the executor of the next.
This ensures that the subsequent phases cannot execute until the preceding phase has completed.
This also allows the phases to maintain the order of processing.
Implements:
Processor
ThreePassProcessorPoolListener
 
Links:
Kernel Association Association Link
to Class ThreePassProcessorConfiguration
Associates type:
aggregation
Client cardinality:
0..*
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Directed.
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
Custom properties
link:
aggregation
 
Kernel Association Association Link
to Class ThreePassProcessorPool
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
 
Kernel Association Association Link
to Class ThreePassProcessorPool
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
 
Kernel Association Association Link
to Class ThreePassProcessorPool
Associates type:
association
Client cardinality:
1
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
 
Kernel Association Association Link
to Interface HandlerRegistry
Associates type:
aggregation
Client cardinality:
0..*
Client navigability:
NOT NAVIGABLE
Client visibility:
private
Directed.
Supplier cardinality:
1
Supplier navigability:
NAVIGABLE
Supplier visibility:
private
Custom properties
link:
aggregation
 
Dependency Dependency Link
to Class EventProcessingTask
Custom properties
link:
dependency
 
Dependency Dependency Link
to Class EventDispatcherTask
Custom properties
link:
dependency
 
Dependency Dependency Link
to Class PredistpatchTask
Custom properties
link:
dependency
 
Dependency Dependency Link
to Class DecodeAndPredistpatchTask
Custom properties
link:
dependency
 
Generalization Generalization Link
to Class AsyncManagedExecutable
ThreePassProcessor is the main implementation of the MessageProcessor.
It provides is the main entry point into the processing system.
Messages are passed to the processor via the process() method.
The three pass processor decouples the decoding of Messages into Events from the processing of the Events.
This decoupling allows the processing to be scalled independently for each of the tasks.
The processing framework splits the message processing into three distinct phases:
i) message decoding and handler lookup for resulting events
ii) dispatching of events into handler
iii) processing of event by the handler

The ThreePassProcessor can be configured such that it guarantees the message
(and event) processing order is maintained.
That is, events arrive in the handler in the same order the that their
associated messages were placed in the processor.

Similarly, the processor framework contains abstractions that allow
event handlers to process events either in parallel or sequentially.
That is, handlers may be created either to allow multiple threads to process
different events with the same handler instance simultaneously OR
to guarantee that only a single thread has access to a handler
instance at a time.

In addition, the framework is designed not to block threads in cases
where their target handler is in use allowing them to drop back to the available pool.

The processing subsystem is designed as an extention to the core Java 1.5 concurrency package facilities.
In order to implement its functionality the ThreePassProcessor leverages the Java 1.5 concurrency Executor concept.
As such, three executors are maintained (one for each phase of processing).
Thus the number of threads associated with each phase can be tuned.
In order to keep the order of the processing consistent across phases,
the processor places a Future returned from one phase to the executor of the next.
This ensures that the subsequent phases cannot execute until the preceding phase has completed.
This also allows the phases to maintain the order of processing.
 
Implementation Implementation Link
to Interface ThreePassProcessorPoolListener
ThreePassProcessor is the main implementation of the MessageProcessor.
It provides is the main entry point into the processing system.
Messages are passed to the processor via the process() method.
The three pass processor decouples the decoding of Messages into Events from the processing of the Events.
This decoupling allows the processing to be scalled independently for each of the tasks.
The processing framework splits the message processing into three distinct phases:
i) message decoding and handler lookup for resulting events
ii) dispatching of events into handler
iii) processing of event by the handler

The ThreePassProcessor can be configured such that it guarantees the message
(and event) processing order is maintained.
That is, events arrive in the handler in the same order the that their
associated messages were placed in the processor.

Similarly, the processor framework contains abstractions that allow
event handlers to process events either in parallel or sequentially.
That is, handlers may be created either to allow multiple threads to process
different events with the same handler instance simultaneously OR
to guarantee that only a single thread has access to a handler
instance at a time.

In addition, the framework is designed not to block threads in cases
where their target handler is in use allowing them to drop back to the available pool.

The processing subsystem is designed as an extention to the core Java 1.5 concurrency package facilities.
In order to implement its functionality the ThreePassProcessor leverages the Java 1.5 concurrency Executor concept.
As such, three executors are maintained (one for each phase of processing).
Thus the number of threads associated with each phase can be tuned.
In order to keep the order of the processing consistent across phases,
the processor places a Future returned from one phase to the executor of the next.
This ensures that the subsequent phases cannot execute until the preceding phase has completed.
This also allows the phases to maintain the order of processing.
 
Implementation Implementation Link
to Interface Processor
ThreePassProcessor is the main implementation of the MessageProcessor.
It provides is the main entry point into the processing system.
Messages are passed to the processor via the process() method.
The three pass processor decouples the decoding of Messages into Events from the processing of the Events.
This decoupling allows the processing to be scalled independently for each of the tasks.
The processing framework splits the message processing into three distinct phases:
i) message decoding and handler lookup for resulting events
ii) dispatching of events into handler
iii) processing of event by the handler

The ThreePassProcessor can be configured such that it guarantees the message
(and event) processing order is maintained.
That is, events arrive in the handler in the same order the that their
associated messages were placed in the processor.

Similarly, the processor framework contains abstractions that allow
event handlers to process events either in parallel or sequentially.
That is, handlers may be created either to allow multiple threads to process
different events with the same handler instance simultaneously OR
to guarantee that only a single thread has access to a handler
instance at a time.

In addition, the framework is designed not to block threads in cases
where their target handler is in use allowing them to drop back to the available pool.

The processing subsystem is designed as an extention to the core Java 1.5 concurrency package facilities.
In order to implement its functionality the ThreePassProcessor leverages the Java 1.5 concurrency Executor concept.
As such, three executors are maintained (one for each phase of processing).
Thus the number of threads associated with each phase can be tuned.
In order to keep the order of the processing consistent across phases,
the processor places a Future returned from one phase to the executor of the next.
This ensures that the subsequent phases cannot execute until the preceding phase has completed.
This also allows the phases to maintain the order of processing.
 
 

Nested Class Summary
public Static class
PoolName
Field Summary
private static Logger
PoolName
DECODER_PREDISPATCHER
PoolName
DISPATCHER
PoolName
PROCESSOR
private HashMap
Constructor Summary
public void
Method Summary
createPoolExcecutor(PoolName pool)
protected synchronized void
protected synchronized void
protected synchronized void
public int
getActiveCount(PoolName pool)
public long
getCompletedTaskCount(PoolName pool)
public int
getCorePoolSize(PoolName pool)
public long
getKeepAliveTime(PoolName pool, TimeUnit unit)
public int
getLargestPoolSize(PoolName pool)
public int
getMaximumPoolSize(PoolName pool)
public int
getPoolSize(PoolName pool)
public long
getTaskCount(PoolName pool)
public synchronized void
poolTerminated(String name)
public synchronized void
process(Message message, MessageDecoder decoder)
public void
process(Event event)
public void
setCorePoolSize(PoolName pool, Integer corePoolSize)
public void
setKeepAliveTime(PoolName pool, Long time, TimeUnit unit)
public void
setMaximumPoolSize(PoolName pool, Integer maximumPoolSize)
Field Detail
config
private ThreePassProcessorConfiguration config
Multiplicity:
1
 

decoderAndPredispatcher
private ThreePassProcessorPool decoderAndPredispatcher
Multiplicity:
1
 

eventDistpacher
private ThreePassProcessorPool eventDistpacher
Multiplicity:
1
 

eventProcessor
private ThreePassProcessorPool eventProcessor
Multiplicity:
1
 

handlerRegistry
private HandlerRegistry handlerRegistry
Multiplicity:
1
 

logger
private static Logger logger
Multiplicity:
1
Static.
 

pools
private HashMap pools
Multiplicity:
1
 
Constructor Detail
ThreePassProcessor
public void ThreePassProcessor (ActiveAgent activeAgent, ThreePassProcessorConfiguration config, HandlerRegistry handlerRegistry)
 
Creates a new ThreePassProcessor wirh the specified configuration.
Parameters:
config
Stereotype:
create
 
Method Detail
createPoolExcecutor
private ThreePassProcessorPool createPoolExcecutor (PoolName pool)
 
Return:
TODO
 

doShutdown
protected synchronized void doShutdown ()
 
Synchronized.
Throws:
ExecutableException
 

doStart
protected synchronized void doStart ()
 
Management interface
Synchronized.
Throws:
ExecutableException
 

doStop
protected synchronized void doStop ()
 
Synchronized.
Throws:
ExecutableException
 

getActiveCount
public int getActiveCount (PoolName pool)
 
Parameters:
pool
Return:
the approximate number of threads that are actively executing
tasks on the given pool.
 

getCompletedTaskCount
public long getCompletedTaskCount (PoolName pool)
 
Parameters:
pool
Return:
the approximate total number of tasks that have completed execution
on the given pool
 

getCorePoolSize
public int getCorePoolSize (PoolName pool)
 
Parameters:
pool
Return:
the core number of threads for the given pool.
 

getKeepAliveTime
public long getKeepAliveTime (PoolName pool, TimeUnit unit)
 
Parameters:
pool
unit
Return:
the thread keep-alive time, which is the amount of time which
threads in excess of the core pool size may remain idle before
being terminated.
 

getLargestPoolSize
public int getLargestPoolSize (PoolName pool)
 
Parameters:
pool
Return:
the largest number of threads that have ever simultaneously been
in the given pool.
 

getMaximumPoolSize
public int getMaximumPoolSize (PoolName pool)
 
Parameters:
pool
Return:
the maximum allowed number of threads for the given pool.
 

getPoolSize
public int getPoolSize (PoolName pool)
 
Parameters:
pool
Return:
the current number of threads in the pool.
 

getTaskCount
public long getTaskCount (PoolName pool)
 
Parameters:
pool
Return:
the approximate total number of tasks that have been scheduled
for execution.
 

poolTerminated
public synchronized void poolTerminated (String name)
 
Synchronized.
Throws:
ExecutableException
 

process
public synchronized void process (Message message, MessageDecoder decoder)
 
Synchronized.
Throws:
ExecutableException
 

process
public void process (Event event)
 
Throws:
ExecutableException
 

setCorePoolSize
public void setCorePoolSize (PoolName pool, Integer corePoolSize)
 
Sets the core number of threads on the given pool.
Parameters:
pool
corePoolSize
 

setKeepAliveTime
public void setKeepAliveTime (PoolName pool, Long time, TimeUnit unit)
 
Sets the time limit for which threads may remain idle before being
terminated.
Parameters:
pool
time
unit
 

setMaximumPoolSize
public void setMaximumPoolSize (PoolName pool, Integer maximumPoolSize)
 
Sets the maximum allowed number of threads for the given pool.
Parameters:
pool
maximumPoolSize
 

Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD