org.oddjob.values
Class ValueQueueService

java.lang.Object
  extended by 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 Summary
ValueQueueService()
           
 
Method Summary
 String getName()
           
 int getSize()
          Get the current size of the queue.
 Iterable<Object> getValues()
          Get the values.
 void setName(String name)
           
 void setValue(Object object)
          Set a value.
 void start()
          Start.
 void stop()
          Stop.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueQueueService

public ValueQueueService()
Method Detail

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