public interface ChronicleQueue
extends net.openhft.chronicle.core.io.Closeable
Using non-heap storage options Chronicle provides a processing environment where applications does not suffer from GarbageCollection. GarbageCollection (GC) may slow down your critical operations non-deterministically at any time.. In order to avoid non-determinism and escape from GC delays off-heap memory solutions are addressed. The main idea is to manage your memory manually so does not suffer from GC. Chronicle behaves like a management interface over off-heap memory so you can build your own solutions over it.
Chronicle uses RandomAccessFiles while managing memory and this choice brings lots of possibility. Random access files permit non-sequential, or random, access to a file's contents. To access a file randomly, you open the file, seek a particular location, and read from or writeBytes to that file. RandomAccessFiles can be seen as "large" C-type byte arrays that you can access any random index "directly" using pointers. File portions can be used as ByteBuffers if the portion is mapped into memory.
ChronicleQueue
(now in the specific sense) is the main interface for management and
can be seen as the "Collection class" of the Chronicle environment. You will reserve a
portion of memory and then put/fetch/update records using the ChronicleQueue
interface.
ExcerptCommon
is the main data container in a ChronicleQueue
, each Chronicle
is composed of Excerpts. Putting data to a queue means starting a new Excerpt, writing data into
it and finishing the Excerpt at the upper.
While ExcerptCommon
is a generic purpose container allowing for remote access, it also
has more specialized counterparts for sequential operations. See ExcerptTailer
and ExcerptAppender
Modifier and Type | Field and Description |
---|---|
static int |
TEST_BLOCK_SIZE |
Modifier and Type | Method and Description |
---|---|
ExcerptAppender |
acquireAppender()
An Appender can be used to writeBytes new excerpts sequentially to the upper.
|
void |
clear()
Remove all the entries in the queue.
|
default ExcerptAppender |
createAppender()
Deprecated.
to be remove in version 4.6 or later use
acquireAppender() |
ExcerptTailer |
createTailer()
Tailers are NOT thread-safe, sharing the Tailer between threads will lead to errors and unpredictable behaviour.
|
default ExcerptTailer |
createTailer(String id)
Tailers are NOT thread-safe, sharing the Tailer between threads will lead to errors and unpredictable behaviour.
|
int |
deltaCheckpointInterval() |
String |
dump()
Dump a Queue in YAML format.
|
default void |
dump(OutputStream stream,
long fromIndex,
long toIndex) |
void |
dump(Writer writer,
long fromIndex,
long toIndex)
Dump a range of entries to a Writer
|
File |
file() |
default String |
fileAbsolutePath()
Cache this value as getAbsolutePath is expensive
|
long |
firstIndex() |
long |
lastAcknowledgedIndexReplicated() |
void |
lastAcknowledgedIndexReplicated(long lastAcknowledgedIndexReplicated) |
long |
lastIndexReplicated()
when using replication to another host, this is the last index that has been sent to the remote host.
|
void |
lastIndexReplicated(long lastIndex) |
default <T> T |
methodWriter(Class<T> tClass,
Class... additional) |
default <T> net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> |
methodWriterBuilder(Class<T> tClass) |
void |
refreshDirectlyListing()
call this method if you delete file from a chronicle-queue directory
|
RollCycle |
rollCycle() |
static ChronicleQueue |
single(String path) |
static SingleChronicleQueueBuilder |
singleBuilder() |
static SingleChronicleQueueBuilder |
singleBuilder(File path) |
static SingleChronicleQueueBuilder |
singleBuilder(Path path) |
static SingleChronicleQueueBuilder |
singleBuilder(String path) |
int |
sourceId() |
net.openhft.chronicle.core.time.TimeProvider |
time() |
net.openhft.chronicle.wire.WireType |
wireType() |
static final int TEST_BLOCK_SIZE
static ChronicleQueue single(String path)
static SingleChronicleQueueBuilder singleBuilder()
static SingleChronicleQueueBuilder singleBuilder(String path)
static SingleChronicleQueueBuilder singleBuilder(File path)
static SingleChronicleQueueBuilder singleBuilder(Path path)
@NotNull ExcerptTailer createTailer()
@NotNull default ExcerptTailer createTailer(String id)
id
- unique id for a tailer which uses to track where it was up to@NotNull ExcerptAppender acquireAppender()
An Appender can be used to writeBytes new excerpts sequentially to the upper.
Appenders are NOT thread-safe, sharing the Appender between threads will lead to errors and unpredictable behaviour.
This method returns ThreadLocal
appender, so does not produce any garbage, hence it's safe to simply call
this method every time an appender is needed.
@NotNull @Deprecated default ExcerptAppender createAppender()
acquireAppender()
long firstIndex()
@NotNull net.openhft.chronicle.wire.WireType wireType()
void clear()
@NotNull File file()
@NotNull default String fileAbsolutePath()
@NotNull String dump()
void dump(Writer writer, long fromIndex, long toIndex)
writer
- to write tofromIndex
- first index to includetoIndex
- last index to include.default void dump(@NotNull OutputStream stream, long fromIndex, long toIndex)
int sourceId()
@NotNull default <T> net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> methodWriterBuilder(@NotNull Class<T> tClass)
RollCycle rollCycle()
net.openhft.chronicle.core.time.TimeProvider time()
int deltaCheckpointInterval()
long lastIndexReplicated()
long lastAcknowledgedIndexReplicated()
void lastIndexReplicated(long lastIndex)
lastIndex
- last index that has been sent to the remote host.void lastAcknowledgedIndexReplicated(long lastAcknowledgedIndexReplicated)
void refreshDirectlyListing()
The problem that we have, is that we cache the structure of your directory, this is because hitting the file system adds latency. Call this method, if you delete .cq4 files, then it will update our caches accordingly,
Copyright © 2019. All rights reserved.