Package org.apache.tika.batch
Class ConsumersManager
- java.lang.Object
-
- org.apache.tika.batch.ConsumersManager
-
- Direct Known Subclasses:
DBConsumersManager
,FSConsumersManager
public abstract class ConsumersManager extends Object
Simple interface around a collection of consumers that allows for initializing and shutting shared resources (e.g. db connection, index, writer, etc.)
-
-
Constructor Summary
Constructors Constructor Description ConsumersManager(List<FileResourceConsumer> consumers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<FileResourceConsumer>
getConsumers()
Get the consumerslong
getConsumersManagerMaxMillis()
BatchProcess
will throw an exception if the ConsumersManager doesn't complete init() or shutdown() within this amount of time.void
init()
This is called by BatchProcess before submitting the threadsvoid
setConsumersManagerMaxMillis(long consumersManagerMaxMillis)
void
shutdown()
This is called by BatchProcess immediately before closing.
-
-
-
Constructor Detail
-
ConsumersManager
public ConsumersManager(List<FileResourceConsumer> consumers)
-
-
Method Detail
-
getConsumers
public List<FileResourceConsumer> getConsumers()
Get the consumers- Returns:
- consumers
-
init
public void init()
This is called by BatchProcess before submitting the threads
-
shutdown
public void shutdown()
This is called by BatchProcess immediately before closing. Beware! Some of the consumers may have hung or may not have completed.
-
getConsumersManagerMaxMillis
public long getConsumersManagerMaxMillis()
BatchProcess
will throw an exception if the ConsumersManager doesn't complete init() or shutdown() within this amount of time.- Returns:
- the maximum time allowed for init() or shutdown()
-
setConsumersManagerMaxMillis
public void setConsumersManagerMaxMillis(long consumersManagerMaxMillis)
- Parameters:
consumersManagerMaxMillis
- maximum number of milliseconds to allow for init() or shutdown()- See Also:
getConsumersManagerMaxMillis()
-
-