public class RecordRingItem
extends java.lang.Object
RecordSupply
class
to provide a very fast supply of RecordOutputStream objects for reuse.
Objects of this class are used to populate the ring buffer in RecordSupply
and are simply a small wrapper around RecordOutputStream objects.
Uses the Disruptor software package.Constructor and Description |
---|
RecordRingItem(java.nio.ByteOrder order,
int maxEventCount,
int maxBufferSize,
CompressionType compressionType)
Constructor.
|
RecordRingItem(RecordRingItem item)
Copy constructor (sort of).
|
Modifier and Type | Method and Description |
---|---|
boolean |
forceToDisk()
Get whether a file writer forces this record to be physically written to disk.
|
void |
forceToDisk(boolean force)
Set whether a file writer forces this record to be physically written to disk.
|
void |
fromConsumer(long seq,
com.lmax.disruptor.Sequence seqObj)
Set the sequence of an item obtained through
RecordSupply.getToCompress(int) . |
void |
fromProducer(long seq)
Set the sequence of an item obtained through
RecordSupply.get() . |
long |
getId()
Get item's id.
|
java.nio.ByteOrder |
getOrder()
Get the byte order used to build record.
|
RecordOutputStream |
getRecord()
Get the contained record.
|
long |
getSequence()
Get the sequence at which this object was taken from ring by one of the "get" calls.
|
com.lmax.disruptor.Sequence |
getSequenceObj()
Get the Sequence object allowing ring consumer to get/release this item.
|
boolean |
isAlreadyReleased()
Has this item already been released by the RecordSupply?
|
boolean |
isCheckDisk()
Get whether there is not enough free space on the disk partition for the
next, complete file to be written, resulting in not creating or writing to file.
|
boolean |
isLastItem()
Get whether this is the last item in the supply to be used.
|
void |
reset()
Method to reset this item each time it is retrieved from the supply.
|
void |
setAlreadyReleased(boolean released)
Set whether this item has already been released by the RecordSupply.
|
void |
setCheckDisk(boolean check)
Set whether there is not enough free space on the disk partition for the
next, complete file to be written, resulting in not creating or writing to file.
|
void |
setId(long id)
Set this item's id number.
|
void |
setLastItem(boolean last)
Set whether this is the last item in the supply to be used.
|
boolean |
splitFileAfterWrite()
Get whether a file writer splits the file after writing this record.
|
void |
splitFileAfterWrite(boolean split)
Set whether a file writer splits the file after writing this record.
|
RecordRingItem(java.nio.ByteOrder order, int maxEventCount, int maxBufferSize, CompressionType compressionType)
order
- byte order of built record byte arrays.maxEventCount
- max number of events record can hold.
Value <= O means use default (1M).maxBufferSize
- max number of uncompressed data bytes record can hold.
Value of < 8MB results in default of 8MB.compressionType
- type of data compression to do.public RecordRingItem(RecordRingItem item)
alreadyReleased
is true. Not to be used except internally by evio.
item
- ring item to copy.public void reset()
public RecordOutputStream getRecord()
public java.nio.ByteOrder getOrder()
public long getSequence()
public com.lmax.disruptor.Sequence getSequenceObj()
public void fromProducer(long seq)
RecordSupply.get()
.seq
- sequence used to get item.public void fromConsumer(long seq, com.lmax.disruptor.Sequence seqObj)
RecordSupply.getToCompress(int)
.seq
- sequence used to get item.seqObj
- sequence object used to get/release item.public boolean splitFileAfterWrite()
public void splitFileAfterWrite(boolean split)
split
- if true, file writer splits the file after writing this record,
else false.public boolean forceToDisk()
public void forceToDisk(boolean force)
force
- if true, file writer forces this record to be physically written
to disk, else false.public boolean isCheckDisk()
public void setCheckDisk(boolean check)
check
- if true, there is not enough free space on the disk partition for the
next, complete file to be written, resulting in not creating or writing to file.public boolean isLastItem()
public void setLastItem(boolean last)
last
- if true, this is the last item in the supply to be used.public boolean isAlreadyReleased()
public void setAlreadyReleased(boolean released)
released
- true if this item has already been released by the RecordSupply,
else false.public long getId()
public void setId(long id)
id
- id number.