|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hazelcast.ringbuffer.impl.RingbufferContainer
public class RingbufferContainer
The RingbufferContainer is responsible for storing the actual content of a ringbuffer. Currently the Ringbuffer is not a partitioned data-structure. So all data of a ringbuffer is stored in a single partition and replicated to the replica's. No thread-safety is needed since a partition can only be accessed by a single thread at any given moment. The ringItems is the ring that contains the actual items. The ringExpiration contains the expiration time of an item. The if a time to live is set, the ringExpiration is created. Otherwise it is null to safe space. The expiration time of an item can be found at the same index as the item itself. So these 2 arrays are always in step with each other. The reason why 2 array are created instead of just wrapping the item in a new object containing the expiration is that we don't want to generate more waste than needed.
Constructor Summary | |
---|---|
RingbufferContainer(RingbufferConfig config,
SerializationService serializationService)
|
|
RingbufferContainer(String name)
|
|
RingbufferContainer(String name,
RingbufferConfig config,
SerializationService serializationService)
|
Method Summary | |
---|---|
long |
add(Data item)
|
long |
addAll(Data[] items)
|
void |
checkBlockableReadSequence(long readSequence)
|
void |
cleanup()
Cleans up the ringbuffer by deleting all expired items. |
int |
getCapacity()
|
RingbufferConfig |
getConfig()
|
RingbufferWaitNotifyKey |
getRingEmptyWaitNotifyKey()
|
long |
headSequence()
|
void |
init(NodeEngine nodeEngine)
|
boolean |
isEmpty()
|
Data |
read(long sequence)
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream |
long |
readMany(long beginSequence,
ReadResultSetImpl result)
|
long |
remainingCapacity()
|
void |
setHeadSequence(long sequence)
|
boolean |
shouldWait(long sequence)
|
long |
size()
|
long |
tailSequence()
|
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RingbufferContainer(String name)
public RingbufferContainer(RingbufferConfig config, SerializationService serializationService)
public RingbufferContainer(String name, RingbufferConfig config, SerializationService serializationService)
Method Detail |
---|
public void init(NodeEngine nodeEngine)
public RingbufferWaitNotifyKey getRingEmptyWaitNotifyKey()
public RingbufferConfig getConfig()
public long tailSequence()
public long headSequence()
public void setHeadSequence(long sequence)
public int getCapacity()
public long size()
public boolean isEmpty()
public boolean shouldWait(long sequence)
public long remainingCapacity()
public void checkBlockableReadSequence(long readSequence)
public long add(Data item)
public long addAll(Data[] items)
public Data read(long sequence)
public long readMany(long beginSequence, ReadResultSetImpl result)
beginSequence
- the sequence of the first item to read.result
- the List where the result are stored in.
public void cleanup()
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- output
IOException
public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- input
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |