Decouple producer from consumer — buffer any OsidList on a virtual thread.
A buffered OsidList wraps an underlying
list and drains it on a virtual thread into a bounded, lock-free
queue (a YACBQueue, DISRUPTOR by default). The
producer thread fills the buffer ahead of the consumer, so a slow
upstream source no longer stalls the reader and a slow reader no
longer stalls the source — the two run independently up to the
buffer's capacity.
Use the buffered list to smooth out a list
whose getNextOsidObject()
performs blocking I/O, or to prefetch while the consumer is busy
with the previous element.
| Parameter | Type | Description |
|---|---|---|
list |
OsidObjectList |
the underlying list to buffer |
bufferSize |
int |
the capacity of the bounded buffer (optional defaults to 256 |