Class CallablePipesIterator

java.lang.Object
org.apache.tika.pipes.pipesiterator.CallablePipesIterator
All Implemented Interfaces:
Callable<Long>

public class CallablePipesIterator extends Object implements Callable<Long>
This is a simple wrapper around PipesIterator that allows it to be called in its own thread.
  • Constructor Details

    • CallablePipesIterator

      public CallablePipesIterator(PipesIterator pipesIterator, ArrayBlockingQueue<FetchEmitTuple> queue)
      This sets timeoutMillis to -1, meaning that this will block forever trying to add fetchemittuples to the queue. This sets the number of PipesIterator.COMPLETED_SEMAPHORE to 1. This means that your consumers must put the semaphore back in the queue after they finish.
      Parameters:
      pipesIterator -
      queue -
    • CallablePipesIterator

      public CallablePipesIterator(PipesIterator pipesIterator, ArrayBlockingQueue<FetchEmitTuple> queue, long timeoutMillis)
      This sets the number of PipesIterator.COMPLETED_SEMAPHORE to 1. This means that your consumers must put the semaphore back in the queue after they finish.
      Parameters:
      pipesIterator - underlying pipes iterator to use
      queue - queue to add the fetch emit tuples to
      timeoutMillis - how long to try to offer the fetch emit tuples to the queue. If -1, this will block with ArrayBlockingQueue.put(Object) forever.
    • CallablePipesIterator

      public CallablePipesIterator(PipesIterator pipesIterator, ArrayBlockingQueue<FetchEmitTuple> queue, long timeoutMillis, int numConsumers)
      Parameters:
      pipesIterator - underlying pipes iterator to use
      queue - queue to add the fetch emit tuples to
      timeoutMillis - how long to try to offer the fetch emit tuples to the queue. If -1, this will block with ArrayBlockingQueue.put(Object) forever.
      numConsumers - how many PipesIterator.COMPLETED_SEMAPHORE to add to the queue. If the consumers are adding this back to the queue when they find it, then this should be set to 1, otherwise, for a single semaphore for each consumer, set this to the number of consumers
  • Method Details