@Internal public class CachedBufferBlocker extends Object implements BufferBlocker
This buffer blocked can be used in credit-based flow control for better barrier alignment in exactly-once mode.
Modifier and Type | Class and Description |
---|---|
static class |
CachedBufferBlocker.CachedBufferOrEventSequence
This class represents a sequence of cached buffers and events, created by the
CachedBufferBlocker . |
Constructor and Description |
---|
CachedBufferBlocker(int pageSize)
Creates a new buffer blocker, caching the buffers or events in memory queue.
|
Modifier and Type | Method and Description |
---|---|
void |
add(BufferOrEvent boe)
Adds a buffer or event to the blocker.
|
void |
close()
Cleans up all the resources in the current sequence.
|
long |
getBytesBlocked()
Gets the number of bytes blocked in the current sequence.
|
BufferOrEventSequence |
rollOverReusingResources()
It is never reusing resources and is defaulting to
rollOverWithoutReusingResources() . |
BufferOrEventSequence |
rollOverWithoutReusingResources()
Starts a new sequence of buffers and event without reusing the same resources and
returns the current sequence of buffers for reading.
|
public CachedBufferBlocker(int pageSize)
pageSize
- The page size used to estimate the cached size.public void add(BufferOrEvent boe)
BufferBlocker
add
in interface BufferBlocker
boe
- The buffer or event to be added into the blocker.public BufferOrEventSequence rollOverReusingResources()
rollOverWithoutReusingResources()
.rollOverReusingResources
in interface BufferBlocker
public BufferOrEventSequence rollOverWithoutReusingResources()
BufferBlocker
rollOverWithoutReusingResources
in interface BufferBlocker
public void close()
BufferBlocker
close
in interface BufferBlocker
public long getBytesBlocked()
BufferBlocker
getBytesBlocked
in interface BufferBlocker
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.