Package io.perl.api
Interface Queue<T>
- All Known Implementing Classes:
AtomicQueue,CQueue,SyncQueue
public interface Queue<T>
A minimal queue abstraction used by PerL to decouple producers and consumers.
Implementations may be backed by any concurrent queue or custom ring-buffer.
Contract:
poll()should return the next element ornullif none is available at the time of the call.add(Object)should enqueue an element and returntrueon success.clear()should remove any pending elements and reset state.
Thread-safety is implementation-specific; callers should prefer implementations that match their concurrency requirements.
-
Method Summary
-
Method Details
-
poll
T poll()Return data of type T from queue, ornullif none is available. -
add
Add data of type T to queue.- Parameters:
data- element to add to the queue- Returns:
- true if the element was added successfully
-
clear
void clear()Clear queue and reset internal state.
-