@Internal public abstract class AbstractBufferStorage extends Object implements BufferStorage
BufferStorage
implementations.Modifier and Type | Field and Description |
---|---|
protected BufferOrEventSequence |
currentBuffered
The sequence of buffers/events that has been unblocked and must now be consumed before
requesting further data from the input gate.
|
protected static org.slf4j.Logger |
LOG |
protected long |
maxBufferedBytes |
protected ArrayDeque<BufferOrEventSequence> |
queuedBuffered
The pending blocked buffer/event sequences.
|
protected long |
rolledBytes
The number of bytes in the queued spilled sequences.
|
protected String |
taskName |
Modifier | Constructor and Description |
---|---|
protected |
AbstractBufferStorage(long maxBufferedBytes,
String taskName) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Cleans up all the resources in the current sequence.
|
protected void |
completeBufferedSequence() |
long |
getMaxBufferedBytes() |
long |
getRolledBytes() |
boolean |
isEmpty() |
boolean |
isFull() |
Optional<BufferOrEvent> |
pollNext() |
void |
rollOver()
Start returning next sequence of stored
BufferOrEvent s. |
protected abstract BufferOrEventSequence |
rollOverReusingResources()
Starts a new sequence of buffers and event reusing the same resources and
returns the current sequence of buffers for reading.
|
protected abstract BufferOrEventSequence |
rollOverWithoutReusingResources()
Starts a new sequence of buffers and event without reusing the same resources and
returns the current sequence of buffers for reading.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, getPendingBytes
protected static final org.slf4j.Logger LOG
protected final ArrayDeque<BufferOrEventSequence> queuedBuffered
protected final long maxBufferedBytes
protected final String taskName
protected BufferOrEventSequence currentBuffered
protected long rolledBytes
protected AbstractBufferStorage(long maxBufferedBytes, String taskName)
public boolean isFull()
isFull
in interface BufferStorage
public void rollOver() throws IOException
BufferStorage
BufferOrEvent
s.rollOver
in interface BufferStorage
IOException
protected abstract BufferOrEventSequence rollOverWithoutReusingResources() throws IOException
IOException
protected abstract BufferOrEventSequence rollOverReusingResources() throws IOException
IOException
public void close() throws IOException
BufferStorage
close
in interface AutoCloseable
close
in interface BufferStorage
IOException
public long getRolledBytes()
getRolledBytes
in interface BufferStorage
public boolean isEmpty()
isEmpty
in interface BufferStorage
BufferStorage
doesn't store and data.public Optional<BufferOrEvent> pollNext() throws IOException
pollNext
in interface BufferStorage
IOException
protected void completeBufferedSequence() throws IOException
IOException
public long getMaxBufferedBytes()
getMaxBufferedBytes
in interface BufferStorage
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.