Class AsyncProcessor

java.lang.Object
org.apache.tika.pipes.core.async.AsyncProcessor
All Implemented Interfaces:
Closeable, AutoCloseable

public class AsyncProcessor extends Object implements Closeable
This is the main class for handling async requests. This manages AsyncClients and AsyncEmitters.
  • Method Details

    • load

      public static AsyncProcessor load(Path tikaConfigPath) throws TikaException, IOException
      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 fails
      TikaException - 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 file
      pipesIterator - optional custom pipes iterator (may be null)
      Returns:
      a new AsyncProcessor instance
      Throws:
      IOException - if reading config or plugin extraction fails
      TikaException - if configuration is invalid
    • offer

      public boolean offer(List<FetchEmitTuple> newFetchEmitTuples, long offerMs) throws PipesException, InterruptedException
      Throws:
      PipesException
      InterruptedException
    • getCapacity

      public int getCapacity()
    • setStopOnlyOnFatal

      public void setStopOnlyOnFatal(boolean stopOnlyOnFatal)
      Long-running callers (tika-server) set true so one bad tuple (unknown fetcher, init failure) can't halt the shared workers; fatal errors always stop processing.
    • offer

      public boolean offer(FetchEmitTuple t, long offerMs) throws PipesException, InterruptedException
      Throws:
      PipesException
      InterruptedException
    • 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

      public void finished() throws InterruptedException
      Throws:
      InterruptedException
    • checkActive

      public boolean checkActive() throws InterruptedException
      Throws:
      InterruptedException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getTotalProcessed

      public long getTotalProcessed()