next up previous contents
Next: View Up: Utility classes Previous: Messages and Headers

Queue

Queues (JavaGroups.Queue) are frequently used when data needs to be passed on from one thread to another (producer-consumer relation). Objects are added to a queue by producers in FIFO order, and consumers can peek at and remove objects from a queue. When no object is available, a consumer will be blocked until an object is added. Queues can be closed, which has the effect that trying to add or remove objects will result in an exception to be thrown. Closing a queue will immediately remove all elements. A more graceful version of closing exists, in which an end-marker is inserted at the7 tail of the queue. When it is encountered, the queue will be closed. This essentially allows all existing objects at the time of the close to be removed (flushed) before actually closing the queue.




1999-12-13