Class ValueQueueService

java.lang.Object
org.oddjob.values.ValueQueueService
All Implemented Interfaces:
ValueConsumer<Object>

public class ValueQueueService extends Object implements ValueConsumer<Object>
Provide a service that supports a blocking Iterable that can be used as the values for a ForEachJob.

Values are placed on the queue by setting the value property.

When this service is stopped any iterators in use return false from their hasNext method. This will cause the foreach job to complete.

Author:
rob
  • Constructor Details

    • ValueQueueService

      public ValueQueueService()
  • Method Details

    • start

      public void start()
      Start.
    • stop

      public void stop()
      Stop.
    • getValues

      public Iterable<Object> getValues()
      Get the values.
      Returns:
      A blocking Iterable. Never null.
    • setValue

      public void setValue(Object object)
      Set a value. This causes the value to be placed on the queue.
      Specified by:
      setValue in interface ValueConsumer<Object>
      Parameters:
      object -
    • getSize

      public int getSize()
      Get the current size of the queue.
      Returns:
      The size.
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object