|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rhi.architecture.parc.filter.AbstractFilter
The AbstractFilter provides a partially implemented Filter allowing simpler concrete Filter objects. It deals w/ thread safe exit logic, and idle cycle detection as well as providing the required hooks for pre & post channel hookup. All concrete filter processing is deferred to a doWork() abstract method.
Note: a simple run() method is provided to support the Runnable Interface.
Constructor Summary | |
protected |
AbstractFilter()
constructor |
protected |
AbstractFilter(int max)
constructor |
Method Summary | |
protected abstract java.util.Collection |
doWork(java.util.Collection in)
Template method to facilitate simple Filter implementations. |
Consumer |
getErrorChannel()
return error channel |
ExceptionHandler |
getExceptionHandler()
return exception handler |
Supplier |
getInbound()
supplier configured on the inbound side of the filter. |
int |
getMaxRecords()
Returns the maxRecords. |
java.lang.String |
getName()
Easy implementation for sub-classes |
Consumer |
getOutbound()
consumer configured on the outbound side of this filter. |
void |
init(java.util.Properties properties)
Initialize common Filter settings. |
protected boolean |
isShutdown()
Returns the shutdown flag |
static Logger |
log()
Returns the log. |
void |
markForDeath()
Tell the filter to shutdown after detecting idle cycles. |
int |
numThreads()
Return the suggested number of threads to launch for this Filter. |
void |
reset()
Reset the filter to ensure that it's ready to process records again. |
void |
run()
Thread execution method. |
void |
setErrorChannel(Consumer err)
Set the error delivery mechanism. |
void |
setExceptionHandler(ExceptionHandler handler)
Set the exception handler mechanism. |
void |
setInbound(Supplier s)
Set the inbound delivery mechanism. |
void |
setMaxRecords(int val)
Method setMaxRecords. |
void |
setNumThreads(int val)
Method setNumThreads. |
void |
setOutbound(Consumer c)
Set the outbound delivery mechanism. |
protected static Logger |
stats()
Returns the Logger instance used for statistics. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.rhi.architecture.parc.Filter |
process |
Constructor Detail |
protected AbstractFilter()
protected AbstractFilter(int max)
max
- - greatest number of records that this
filter will accept from the channel in 1 batch. Used
in conjunction w/ the thread count to performance tune
the pipeline.Method Detail |
public void init(java.util.Properties properties) throws InitializationException
init
in interface Filter
properties
-
InitializationException
public void run()
run
in interface java.lang.Runnable
protected abstract java.util.Collection doWork(java.util.Collection in) throws ProcessingException
This method, just like process(), is part of the main thread loop and therefore must be thread safe.
in
-
ProcessingException
public void markForDeath()
markForDeath
in interface Filter
public void reset()
Note: Although it's thread safe due to the volatile keyword, the reset() method is intended to be used
reset
in interface Filter
protected boolean isShutdown()
public void setInbound(Supplier s)
setInbound
in interface Filter
s
- public Supplier getInbound()
public void setOutbound(Consumer c)
setOutbound
in interface Filter
c
- public Consumer getOutbound()
public void setErrorChannel(Consumer err)
setErrorChannel
in interface Filter
err
- public Consumer getErrorChannel()
public void setExceptionHandler(ExceptionHandler handler)
setExceptionHandler
in interface Filter
handler
- public ExceptionHandler getExceptionHandler()
public java.lang.String getName()
getName
in interface Filter
public void setNumThreads(int val)
val
- public int numThreads()
numThreads
in interface Filter
public void setMaxRecords(int val)
val
- public int getMaxRecords()
protected static Logger stats()
public static Logger log()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |