|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxsmeral.pipe.Pipe
public class Pipe
A simple implementation of the Chain of Responsibility pattern.
Works similar to a unix pipe, working over objects, with processors executed
in separate threads.
| Constructor Summary | |
|---|---|
Pipe(List<ObjectProcessor> processors)
Initializes the pipe with supplied chain of processors and instantiates a context. |
|
Pipe(List<ObjectProcessor> processors,
Collection<AttachedProcessor> attached)
In addition to Pipe(java.util.List) also sets attached processors. |
|
Pipe(ObjectProcessor[] processors)
Does the same as calling Pipe(Arrays.asList(processors)) |
|
| Method Summary | |
|---|---|
Collection<AttachedProcessor> |
getAttached()
Returns list of attached processors. |
PipeContext |
getContext()
Returns the context associated with this pipe and all processors. |
List<ObjectProcessor> |
getProcessors()
Returns list of processors in this chain, order from input to output |
ObjectProcessor.Status |
getStatus()
Returns the status of this pipe, determined by the status of the processors. |
void |
kill()
Interrupts all threads sequentially, possibly leaving the processors in an indeterminate and erroneous state. |
void |
start(boolean blocking)
Connects processors, checks input-output type match, assigns and initializes context. |
void |
stop(boolean blocking)
Signals the first processor to stop, which should propagate to all following processors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Pipe(List<ObjectProcessor> processors,
Collection<AttachedProcessor> attached)
Pipe(java.util.List) also sets attached processors.
processors - List of processors, ordered from the first (source) to last (sink).AttachedProcessorpublic Pipe(List<ObjectProcessor> processors)
processors - List of processors, ordered from the first (source) to last (sink).public Pipe(ObjectProcessor[] processors)
Pipe(Arrays.asList(processors))
processors - Array of processors| Method Detail |
|---|
public List<ObjectProcessor> getProcessors()
public Collection<AttachedProcessor> getAttached()
public PipeContext getContext()
public ObjectProcessor.Status getStatus()
public void start(boolean blocking)
throws ObjectProcessorException
AbstractObjectProcessor class, section "Context initialization".
blocking - If set to true, the method doesn't return until all
processor threads stop
ObjectProcessorException - If a condition for starting was not met
(non-matching outputs/inputs, processor fails to start, invalid object
is passed as processor, context parameter dependency conflict)public void stop(boolean blocking)
blocking - If set to true, the method doesn't return until all
threads stoppublic void kill()
stop() should be used instead.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||