public interface ExcerptAppender extends ExcerptCommon<ExcerptAppender>, net.openhft.chronicle.wire.MarshallableOut
The component that facilitates sequentially writing data to a ChronicleQueue.
NOTE: Appenders are NOT thread-safe, sharing the Appender between threads will lead to errors and unpredictable behaviour.
| Modifier and Type | Method and Description |
|---|---|
long |
batchAppend(int timeoutMS,
BatchAppender batchAppender)
Deprecated.
This method is not recommended unless you really
know what you are doing. Misuse of this API could corrupt your data or even
worst cause the JVM or your application to crash.
|
int |
cycle()
Returns the cycle this appender is on.
|
default Runnable |
getCloserJob()
A task that will be run if a WeakReference referring this appender is registered with a clean-up task.
|
long |
lastIndexAppended()
Returns the index last written.
|
default <T> T |
methodWriter(Class<T> tClass,
Class... additional)
Creates and returns a new writer proxy for the given interface
tclass and the given additional
interfaces. |
default <T> net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> |
methodWriterBuilder(Class<T> tClass)
Creates and returns a new writer proxy for the given interface
tclass. |
void |
padToCacheAlign(net.openhft.chronicle.wire.MarshallableOut.Padding padToCacheAlign)
Sets the
Padding to be used for this ExcerptAppender. |
net.openhft.chronicle.wire.MarshallableOut.Padding |
padToCacheAlignMode()
Returns the current
Padding used by this ExcerptAppender. |
default void |
pretouch()
Pre-touches storage resources for the current queue so that appenders
may exhibit more predictable latencies.
|
net.openhft.chronicle.wire.Wire |
wire()
Returns a raw wire for low level direct access.
|
default void |
writeBytes(net.openhft.chronicle.bytes.Bytes bytes)
Writes (i.e.
|
void |
writeBytes(net.openhft.chronicle.bytes.BytesStore bytes)
Writes (i.e.
|
queue, sourceIdvoid writeBytes(@NotNull
net.openhft.chronicle.bytes.BytesStore bytes)
throws net.openhft.chronicle.wire.UnrecoverableTimeoutException
bytes to the queue.bytes - to write to excerpt.net.openhft.chronicle.wire.UnrecoverableTimeoutExceptiondefault void writeBytes(@NotNull
net.openhft.chronicle.bytes.Bytes bytes)
throws net.openhft.chronicle.wire.UnrecoverableTimeoutException
bytes to the queue.bytes - to write to excerpt.net.openhft.chronicle.wire.UnrecoverableTimeoutExceptionlong lastIndexAppended()
The index includes the cycle and the sequence number.
IllegalStateException - if no index is availableint cycle()
Usually with chronicle-queue each cycle will have its own unique data file to store the excerpts
default void pretouch()
Pre-touching involves accessing pages of files/memory that are likely accessed in a near future and may also involve accessing/acquiring future cycle files.
We suggest this code is called from a background thread [ not you main business thread ], it must be called from the same thread that created it, as the call to pretouch() is not thread safe. For example :
newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> queue.acquireAppender().pretouch(), 0, 1, TimeUnit.SECONDS);
void padToCacheAlign(net.openhft.chronicle.wire.MarshallableOut.Padding padToCacheAlign)
Padding to be used for this ExcerptAppender.
Enable padding if near the end of a cache line, pad it so a following 4-byte int value will not split a cache line.
MarshallableOut.Padding@NotNull net.openhft.chronicle.wire.MarshallableOut.Padding padToCacheAlignMode()
Padding used by this ExcerptAppender.padToCacheAlignMode in interface net.openhft.chronicle.wire.MarshallableOutPadding used by this ExcerptAppenderdefault Runnable getCloserJob()
@NotNull
default <T> T methodWriter(@NotNull
Class<T> tClass,
Class... additional)
tclass and the given additional
interfaces.
When methods are invoked on the returned T object, messages will be put in the queue.
Writers are NOT thread-safe. Sharing a Writer across threads will lead to errors and unpredictable behaviour.
methodWriter in interface net.openhft.chronicle.wire.MarshallableOutT - type parameter of the main interfacetClass - of the main interface to be implementedadditional - interfaces to be implementedtclass and the given additional
interfacesNullPointerException - if any of the provided parameters are null.@NotNull
default <T> net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> methodWriterBuilder(@NotNull
Class<T> tClass)
tclass.
When methods are invoked on the returned T object, messages will be put in the queue.
Writers are NOT thread-safe. Sharing a Writer across threads will lead to errors and unpredictable behaviour.
methodWriterBuilder in interface net.openhft.chronicle.wire.MarshallableOutT - type parameter of the main interfacetClass - of the main interface to be implementedtclassNullPointerException - if the provided parameter is null.net.openhft.chronicle.wire.Wire wire()
@Deprecated long batchAppend(int timeoutMS, BatchAppender batchAppender)
timeoutMS - time out in milisecondsbatchAppender - to apply for the batch appendBatchAppenderCopyright © 2019. All rights reserved.