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.
|
long |
lastIndexAppended()
Returns the index last written.
|
default <T> T |
methodWriter(@NotNull Class<T> tClass,
Class... additional)
Creates and returns a new writer proxy for the given interface
tclass and the given additional
interfaces. |
default <T> @NotNull net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> |
methodWriterBuilder(@NotNull Class<T> tClass)
Creates and returns a new writer proxy for the given interface
tclass. |
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(@NotNull net.openhft.chronicle.bytes.Bytes bytes)
Writes (i.e.
|
void |
writeBytes(@NotNull net.openhft.chronicle.bytes.BytesStore bytes)
Writes (i.e.
|
disableThreadSafetyCheck, queue, sourceIdclose, closeQuietly, closeQuietly, notifyClosingvoid writeBytes(@NotNull
@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
@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);
@NotNull
default <T> T methodWriter(@NotNull
@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> @NotNull net.openhft.chronicle.wire.VanillaMethodWriterBuilder<T> methodWriterBuilder(@NotNull
@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 © 2020. All rights reserved.