|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
E - public interface BatchingQueue<E>
A queue API that allows batching and pooling of objects. So to offer to the queue, you first get a mutable object from the queue by calling nextToDispatch(), alter this object and call flush(boolean lazySet). That allows the queue objects to be pooled, avoiding any garbage collection. And to poll you first call availableToPoll() to know how many objects you can safely poll, call poll() in a loop and when done call donePolling(boolean lazySet). That allows polling to be batched, so you pay a synchronization price only when you call available() and NOT when you call poll().
| Method Summary | |
|---|---|
long |
availableToPoll()
Return the number of objects that can be safely polled from this queue. |
void |
donePolling()
Called to indicate that all polling have been concluded. |
void |
donePolling(boolean lazySet)
Called to indicate that all polling have been concluded. |
void |
flush()
Dispatch *immediately* all previously obtained objects through the nextToDispatch() method to the queue. |
void |
flush(boolean lazySet)
Dispatch all previously obtained objects through the nextToDispatch() method to the queue. |
E |
nextToDispatch()
Return the next pooled mutable object that can be used by the producer to dispatch data to the queue. |
E |
poll()
Poll a object from the queue. |
void |
rollback()
Pretend you never polled the last object you polled since the last time you called donePolling(). |
| Method Detail |
|---|
E nextToDispatch()
void flush(boolean lazySet)
lazySet - flush (i.e. notify the consumer) in a lazy way or flush immediatelyvoid flush()
long availableToPoll()
E poll()
void donePolling(boolean lazySet)
lazySet - notify the producer in a lazy way or notify the producer immediatelyvoid donePolling()
void rollback()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||