|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jcreme.processing.AbstractProducer
This class takes care of the basic production mechanisms. It is valid for any Producer since it does nor introduce any dependency on a Consumer. Producers should basically derive from this class although this is by no a necessity.
Constructor Summary | |
AbstractProducer(int initialProductionQueueSize,
int initialValidationQueueSize)
Creates new AbstractProducer |
Method Summary | |
protected java.util.Collection |
getItemsBeingConsumed()
Returns the Collection of the items that are being consumed. |
java.util.Collection |
getProducedItems()
Returns the Collection of the items that are available for consumption. |
boolean |
isProductionOver()
Returns true if the production is over, false if not. |
java.lang.Object |
nextItem()
Returns the next item free for consumption. |
java.lang.Object |
nextItem(int timeout)
Returns the next item free for consumption. |
abstract boolean |
produceItem()
Produces next item, i.e. marks it as consumable. |
protected void |
publishItem(java.lang.Object theItem)
This method enables to put a newly produced item in the production queue. |
void |
setProductionOver(boolean bool)
Sets a flag that shows whether the production is over. |
boolean |
validateItem(java.lang.Object theItem)
Validates an item, i.e. marks it as having been consumed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractProducer(int initialProductionQueueSize, int initialValidationQueueSize)
initialProductionQueueSize
- the size of the production queue when it is initialized.initialValidationQueueSize
- the size of the validation queue when it is initialized.Method Detail |
public java.lang.Object nextItem()
nextItem
in interface Producer
Producer.nextItem()
public java.lang.Object nextItem(int timeout)
timeout
- the number of milliseconds the call will wait for an available
item.
Producer.nextItem()
public boolean validateItem(java.lang.Object theItem)
validateItem
in interface Producer
theItem
- The item to be validated.
Producer.validateItem(java.lang.Object)
protected void publishItem(java.lang.Object theItem)
theItem
- the item to make available for consumption.public void setProductionOver(boolean bool)
setProductionOver
in interface Producer
bool
- The boolean value that the flag has to be set on.Producer.setProductionOver(boolean)
public boolean isProductionOver()
isProductionOver
in interface Producer
Producer.isProductionOver()
public abstract boolean produceItem()
produceItem
in interface Producer
protected java.util.Collection getItemsBeingConsumed()
public java.util.Collection getProducedItems()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |