|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectxsmeral.pipe.AbstractObjectProcessor
xsmeral.pipe.LocalObjectSource<O>
O - Output object type@ObjectProcessorInterface(out=java.lang.Object.class) public class LocalObjectSource<O>
An object processor in the role of an object source, produces objects.
Can only be placed as the first processor in a processor chain.
Provides default ObjectProcessorInterface set to Objects.
Uses ArrayBlockingQueue as the output buffer.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface xsmeral.pipe.interfaces.ObjectProcessor |
|---|
ObjectProcessor.Status |
| Field Summary | |
|---|---|
protected ObjectSink<O> |
next
Reference to the next processor in chain. |
protected BlockingQueue<O> |
outBuffer
A buffer between the current and the next processor. |
protected int |
outBufferCapacity
Output buffer capacity, defaults to 10000 objects |
| Fields inherited from class xsmeral.pipe.AbstractObjectProcessor |
|---|
canStart, context, status |
| Constructor Summary | |
|---|---|
LocalObjectSource()
Instantiates the output buffer, set to the default capacity |
|
LocalObjectSource(BlockingQueue<O> outBuffer)
Sets the output buffer to the one given |
|
| Method Summary | |
|---|---|
ObjectSink<O> |
getNext()
Returns the next processor in chain. |
BlockingQueue<O> |
getOutBuffer()
Returns the output buffer of this processor. |
protected void |
handleStoppedSink()
Called in case the next processor is stopped during a write operation. |
void |
next(ObjectSink<O> sink)
Sets the next processor in the chain and sets this as its previous. |
protected void |
process()
Called by the processor itself from run(). |
protected void |
setNext(ObjectSink<O> sink)
Sets the next processor, without calling prev() on the sink. |
protected void |
setOutBuffer(BlockingQueue<O> buffer)
Sets the output buffer, used for object flow redirection. |
protected void |
write(O o)
Puts one object to the output buffer |
| Methods inherited from class xsmeral.pipe.AbstractObjectProcessor |
|---|
canStart, failStart, failStart, failStart, getContext, getInType, getOutType, getParams, getStatus, initContext, initContextSet, initialize, initializeInternal, initPostContext, initWithContext, postRun, preRun, requestStop, run, setContext, stop, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface xsmeral.pipe.interfaces.ObjectSource |
|---|
getOutType |
| Field Detail |
|---|
protected BlockingQueue<O> outBuffer
protected ObjectSink<O> next
protected int outBufferCapacity
| Constructor Detail |
|---|
public LocalObjectSource()
public LocalObjectSource(BlockingQueue<O> outBuffer)
| Method Detail |
|---|
protected final void write(O o)
throws ProcessorStoppedException
o - The object to write
SinkStoppedException - If the sink is in
STOPPED
state and thus no longer reads the bufferhandleStoppedSink() immediately before throwing.
ProcessorStoppedExceptionpublic final BlockingQueue<O> getOutBuffer()
ObjectSource
getOutBuffer in interface ObjectSource<O>protected final void setOutBuffer(BlockingQueue<O> buffer)
protected final void setNext(ObjectSink<O> sink)
prev() on the sink.
public final void next(ObjectSink<O> sink)
ObjectSource
next in interface ObjectSource<O>sink - The next processorpublic final ObjectSink<O> getNext()
ObjectSource
getNext in interface ObjectSource<O>protected void handleStoppedSink()
write operation.
Can be used, for example, to persist objects left in the buffer.
protected void process()
throws ProcessorStoppedException
run().
Should process one object and return.
More information in description of AbstractObjectProcessor class, section "Running".
This implementation is empty and should be overridden.
process in class AbstractObjectProcessorProcessorStoppedException - If a neighboring processor has stopped.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||