poll() — netty Function Reference
Architecture documentation for the poll() function in MpscIntQueue.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6c53d641_1124_ccce_e265_4ede0841b9c5["poll()"] c00a7e8d_e19a_6d4a_6887_5d0634281bed["MpscAtomicIntegerArrayQueue"] 6c53d641_1124_ccce_e265_4ede0841b9c5 -->|defined in| c00a7e8d_e19a_6d4a_6887_5d0634281bed fb7f0fff_a870_3ec4_c353_7341bc7fdd2e["offer()"] fb7f0fff_a870_3ec4_c353_7341bc7fdd2e -->|calls| 6c53d641_1124_ccce_e265_4ede0841b9c5 style 6c53d641_1124_ccce_e265_4ede0841b9c5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/main/java/io/netty/util/concurrent/MpscIntQueue.java lines 160–183
@Override
public int poll() {
final long cIndex = consumerIndex;
final int offset = (int) (cIndex & mask);
// If we can't see the next available element we can't poll
int value = get(offset);
if (emptyValue == value) {
/*
* NOTE: Queue may not actually be empty in the case of a producer (P1) being interrupted after
* winning the CAS on offer but before storing the element in the queue. Other producers may go on
* to fill up the queue after this element.
*/
if (cIndex != producerIndex) {
do {
value = get(offset);
} while (emptyValue == value);
} else {
return emptyValue;
}
}
lazySet(offset, emptyValue);
CONSUMER_INDEX.lazySet(this, cIndex + 1);
return value;
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does poll() do?
poll() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/MpscIntQueue.java.
Where is poll() defined?
poll() is defined in common/src/main/java/io/netty/util/concurrent/MpscIntQueue.java at line 160.
What calls poll()?
poll() is called by 1 function(s): offer.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free