public class LinkedBufferStorage extends Object implements BufferStorage
BufferStorage
that links two BufferStorage
together.
Each of the linked BufferStorage
will store buffers independently, but they will be
linked together for rollOver()
- if one is rolled over, other will do that as well.
Note that only mainStorage
is closed when LinkedBufferStorage
instance is closed.
Constructor and Description |
---|
LinkedBufferStorage(BufferStorage mainStorage,
BufferStorage linkedStorage,
long maxBufferedBytes) |
Modifier and Type | Method and Description |
---|---|
void |
add(BufferOrEvent boe)
Adds a buffer or event to the
BufferStorage . |
void |
close()
Cleans up all the resources in the current sequence.
|
long |
getMaxBufferedBytes() |
long |
getPendingBytes() |
long |
getRolledBytes() |
boolean |
isEmpty() |
boolean |
isFull() |
Optional<BufferOrEvent> |
pollNext() |
void |
rollOver()
Start returning next sequence of stored
BufferOrEvent s. |
public LinkedBufferStorage(BufferStorage mainStorage, BufferStorage linkedStorage, long maxBufferedBytes)
public void add(BufferOrEvent boe) throws IOException
BufferStorage
BufferStorage
.add
in interface BufferStorage
boe
- The buffer or event to be added into the blocker.IOException
public boolean isFull()
isFull
in interface BufferStorage
public void rollOver() throws IOException
BufferStorage
BufferOrEvent
s.rollOver
in interface BufferStorage
IOException
public long getPendingBytes()
getPendingBytes
in interface BufferStorage
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
public long getMaxBufferedBytes()
getMaxBufferedBytes
in interface BufferStorage
public void close() throws IOException
BufferStorage
close
in interface AutoCloseable
close
in interface BufferStorage
IOException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.