Package org.apache.tika.pipes.core.async
Class AsyncProcessor
java.lang.Object
org.apache.tika.pipes.core.async.AsyncProcessor
- All Implemented Interfaces:
Closeable,AutoCloseable
This is the main class for handling async requests. This manages
AsyncClients and AsyncEmitters.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclose()voidfinished()intlongbooleanReturns true if an application error has occurred during processing.static AsyncProcessorLoads an AsyncProcessor from a configuration file path.static AsyncProcessorload(Path tikaConfigPath, PipesIterator pipesIterator) Loads an AsyncProcessor from a configuration file path with a custom PipesIterator.booleanoffer(List<FetchEmitTuple> newFetchEmitTuples, long offerMs) booleanoffer(FetchEmitTuple t, long offerMs)
-
Method Details
-
load
Loads an AsyncProcessor from a configuration file path.This method pre-extracts plugins before loading, ensuring child processes don't race to extract the same plugins.
- Parameters:
tikaConfigPath- path to the tika-config.json file- Returns:
- a new AsyncProcessor instance
- Throws:
IOException- if reading config or plugin extraction failsTikaException- if configuration is invalid
-
load
public static AsyncProcessor load(Path tikaConfigPath, PipesIterator pipesIterator) throws TikaException, IOException Loads an AsyncProcessor from a configuration file path with a custom PipesIterator.This method pre-extracts plugins before loading, ensuring child processes don't race to extract the same plugins.
- Parameters:
tikaConfigPath- path to the tika-config.json filepipesIterator- optional custom pipes iterator (may be null)- Returns:
- a new AsyncProcessor instance
- Throws:
IOException- if reading config or plugin extraction failsTikaException- if configuration is invalid
-
offer
public boolean offer(List<FetchEmitTuple> newFetchEmitTuples, long offerMs) throws PipesException, InterruptedException - Throws:
PipesExceptionInterruptedException
-
getCapacity
public int getCapacity() -
offer
- Throws:
PipesExceptionInterruptedException
-
hasApplicationError
public boolean hasApplicationError()Returns true if an application error has occurred during processing. When this returns true, all workers have stopped or are stopping, and no new tuples can be offered.- Returns:
- true if an application error occurred
-
finished
- Throws:
InterruptedException
-
checkActive
- Throws:
InterruptedException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getTotalProcessed
public long getTotalProcessed()
-