public final class ChronicleQueueView<T,M> extends net.openhft.chronicle.core.io.AbstractCloseable implements QueueView<T,M>, MapView<T,M>, HasTailer<T,M>, SubAssetFactory
QueueView.Excerpt<T,M>, QueueView.Tailer<T,M>
Modifier and Type | Method and Description |
---|---|
Asset |
asset() |
@NotNull net.openhft.chronicle.queue.impl.RollingChronicleQueue |
chronicleQueue() |
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
static @NotNull ChronicleQueueView |
create(@NotNull RequestContext context,
@NotNull Asset asset) |
<E> @NotNull Asset |
createSubAsset(@NotNull VanillaAsset vanillaAsset,
String name,
Class<E> valueType) |
@NotNull EntrySetView<T,M> |
entrySet() |
@Nullable QueueView.Excerpt<T,M> |
excerpt(long index)
|
protected void |
finalize() |
M |
get(Object key) |
M |
getAndPut(T key,
M value)
Explicitly get the old value before putting a new one.
|
M |
getAndRemove(T key)
Explicitly get the old value before removing.
|
M |
getUsing(T key,
Object using)
Obtain a value using a mutable buffer provided.
|
boolean |
isEmpty() |
@NotNull KeySetView<T> |
keySet() |
Class<T> |
keyType() |
long |
longSize() |
MapView<T,M> |
mapView() |
QueueView.Excerpt<T,M> |
next(long index)
Returns the
QueueView.Excerpt immediately following the Excerpt at a given index or null if no such Excerpt exists. |
@Nullable QueueView.Excerpt<T,M> |
next(T topic)
Returns the next unread message from the tailer with the provided
topic or null if no such Excerpt exists. |
@NotNull File |
path() |
protected void |
performClose() |
void |
publish(T topic,
M message)
Publish the given
message to the provided topic . |
long |
publishAndIndex(T topic,
M message)
Publish the given
message to the provided topic . |
@NotNull Publisher<M> |
publisher(T topic)
Creates and returns a new Publisher for the provided
topic . |
M |
put(T key,
M value) |
void |
putAll(@NotNull Map<? extends T,? extends M> m) |
M |
putIfAbsent(T key,
M value) |
Reference<M> |
referenceFor(T key)
Obtain a reference the value for a key
|
void |
registerKeySubscriber(@NotNull Subscriber<? super T> subscriber)
Add a Subscription for the keys changed on this Map
|
void |
registerKeySubscriber(@NotNull Subscriber<? super T> subscriber,
@NotNull Filter filter,
@NotNull Set<RequestContext.Operation> contextOperations)
Add a Subscription for the keys changed on this Map
|
void |
registerSubscriber(@NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber)
Add a Subscription for the MapEvents triggered by changes on this Map.
|
void |
registerSubscriber(@NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber,
@NotNull Filter<? extends MapEvent<? super T,? super M>> filter,
@NotNull Set<RequestContext.Operation> contextOperations)
Add a Subscription for the MapEvents triggered by changes on this Map.
|
void |
registerSubscriber(T topic,
@NotNull Subscriber<? super M> subscriber)
Registers and associates the provided
subscriber with the provided topic . |
void |
registerTopicSubscriber(boolean bootstrap,
@NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
Add a subscription to this group.
|
void |
registerTopicSubscriber(@NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
Add a subscription to this group.
|
M |
remove(Object key) |
boolean |
remove(@NotNull Object key,
Object value) |
M |
replace(T key,
M value) |
boolean |
replace(T key,
M oldValue,
M newValue) |
void |
set(T key,
M element) |
@NotNull QueueView.Tailer<T,M> |
tailer()
Create and returns a new Tailer that starts from the beginning of the queue.
|
@NotNull QueueView.Tailer<T,M> |
tailerToEnd()
Create and returns a new Tailer that starts from the end of the queue.
|
net.openhft.chronicle.queue.impl.RollingChronicleQueue |
underlying() |
void |
unregisterSubscriber(T topic,
@NotNull Subscriber<? super M> subscriber)
Unregisters and disassociates the provided
subscriber from the provided topic . |
void |
unregisterTopicSubscriber(@NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
Unregister a TopicSubscriber
|
void |
unregisterTopicSubscriber(T topic,
@NotNull TopicSubscriber<? super T,? super M> topicSubscriber) |
@NotNull Collection<M> |
values() |
Class<M> |
valueType() |
@NotNull net.openhft.chronicle.wire.WireType |
wireType() |
assertCloseablesClosed, clearUsedByThread, close, createdHere, disableCloseableTracing, disableThreadSafetyCheck, disableThreadSafetyCheck, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, resetUsedByThread, shouldPerformCloseInBackground, shouldWaitForClosed, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, toString, unmonitor, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosed
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, closeQuietly, closeQuietly
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
applyTo, applyTo, asyncUpdate, asyncUpdate, syncUpdate, syncUpdate
applyToKey, applyToKey, asyncUpdateKey, asyncUpdateKey, syncUpdateKey, syncUpdateKey
@NotNull public static @NotNull ChronicleQueueView create(@NotNull @NotNull RequestContext context, @NotNull @NotNull Asset asset)
@NotNull public @NotNull net.openhft.chronicle.queue.impl.RollingChronicleQueue chronicleQueue()
@NotNull public @NotNull KeySetView<T> keySet()
@NotNull public @NotNull EntrySetView<T,M> entrySet()
@NotNull public M getUsing(T key, Object using)
MapView
public void registerTopicSubscriber(@NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
TopicPublisher
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerTopicSubscriber
in interface MapView<T,M>
registerTopicSubscriber
in interface TopicPublisher<T,M>
topicSubscriber
- to listen to events.public void registerTopicSubscriber(boolean bootstrap, @NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
TopicPublisher
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerTopicSubscriber
in interface TopicPublisher<T,M>
topicSubscriber
- to listen to events.public void unregisterTopicSubscriber(@NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
TopicPublisher
This method is asynchronous and the provided subscriber will be prevented from receiving events as some later unspecified time.
unregisterTopicSubscriber
in interface TopicPublisher<T,M>
topicSubscriber
- to unregisterpublic void registerKeySubscriber(@NotNull @NotNull Subscriber<? super T> subscriber)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerKeySubscriber
in interface MapView<T,M>
subscriber
- to addpublic void registerKeySubscriber(@NotNull @NotNull Subscriber<? super T> subscriber, @NotNull @NotNull Filter filter, @NotNull @NotNull Set<RequestContext.Operation> contextOperations)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerKeySubscriber
in interface MapView<T,M>
subscriber
- to addfilter
- a list of filter operationscontextOperations
- which optional operations to consider (e.g. bootstrap and ending after bootstrap)public void registerSubscriber(@NotNull @NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber, @NotNull @NotNull Filter<? extends MapEvent<? super T,? super M>> filter, @NotNull @NotNull Set<RequestContext.Operation> contextOperations)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerSubscriber
in interface MapView<T,M>
subscriber
- the subscriber to the subscriptionfilter
- to apply on keys and valuescontextOperations
- which optional operations to consider (e.g. bootstrap and ending after bootstrap)public void unregisterSubscriber(@NotNull T topic, @NotNull @NotNull Subscriber<? super M> subscriber)
TopicPublisher
subscriber
from the provided topic
.
This method is asynchronous and the provided subscriber will be prevented from receiving events as some later unspecified time.
unregisterSubscriber
in interface TopicPublisher<T,M>
topic
- to disassociates from the given subscriber
subscriber
- to unregisterpublic Reference<M> referenceFor(T key)
MapView
referenceFor
in interface MapView<T,M>
key
- to bind the reference topublic long longSize()
@Nullable public M getAndPut(T key, M value)
MapView
@Nullable public M getAndRemove(T key)
MapView
getAndRemove
in interface MapView<T,M>
key
- to removepublic void unregisterTopicSubscriber(@NotNull T topic, @NotNull @NotNull TopicSubscriber<? super T,? super M> topicSubscriber)
@NotNull public @NotNull Publisher<M> publisher(@NotNull T topic)
TopicPublisher
topic
.publisher
in interface TopicPublisher<T,M>
topic
- to create a Publisher fortopic
public void registerSubscriber(@NotNull T topic, @NotNull @NotNull Subscriber<? super M> subscriber)
TopicPublisher
subscriber
with the provided topic
.
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerSubscriber
in interface TopicPublisher<T,M>
topic
- to associate with the given subscriber
subscriber
- to register@NotNull public @NotNull QueueView.Tailer<T,M> tailer()
HasTailer
@NotNull public @NotNull QueueView.Tailer<T,M> tailerToEnd()
HasTailer
tailerToEnd
in interface HasTailer<T,M>
@Nullable public @Nullable QueueView.Excerpt<T,M> excerpt(long index)
QueueView
QueueView.Excerpt
at a given index
or null
if no such Excerpt exists.
If the provided index
is 0, then the excerpt at the first index is returned
If the index is not a valid index, the operation is undefined.
The Excerpt object returned may be reused between invocations of methods provided by a QueueView.
public QueueView.Excerpt<T,M> next(long index)
QueueView
QueueView.Excerpt
immediately following the Excerpt at a given index
or null
if no such Excerpt exists. This method
is useful for continuously reading Excerpts in an environment where the client can switch between several servers.
In other words, assuming that the queue has not rolled, returns an excerpt who's index is the provided index
+ 1
If the provided index
is 0, then the excerpt at the second index is returned
If the index is not a valid index, the operation is undefined.
The Excerpt object returned may be reused between invocations of methods provided by a QueueView.
next
in interface QueueView<T,M>
index
- the address of a previous except for which the next Excerpt is to be retrievedQueueView.Excerpt
immediately following the Excerpt at a given index or null
if no such Excerpt exists@Nullable public @Nullable QueueView.Excerpt<T,M> next(@NotNull T topic)
QueueView
topic
or null
if no such Excerpt exists.
The Excerpt object returned may be reused between invocations of methods provided by a QueueView.
public void set(T key, M element)
set
in interface KeyedVisitable<T,M>
key
- to set within this collection.element
- replace the current state of the visitable Assetpublic void publish(@NotNull T topic, @NotNull M message)
TopicPublisher
message
to the provided topic
.publish
in interface TopicPublisher<T,M>
topic
- to publish tomessage
- to publish.public long publishAndIndex(@NotNull T topic, @Nullable M message)
QueueView
message
to the provided topic
.publishAndIndex
in interface QueueView<T,M>
topic
- to publish tomessage
- to publish.public boolean containsKey(Object key)
containsKey
in interface Map<T,M>
public boolean containsValue(Object value)
containsValue
in interface Map<T,M>
@NotNull public @NotNull File path()
@NotNull public @NotNull net.openhft.chronicle.wire.WireType wireType()
protected void performClose()
performClose
in class net.openhft.chronicle.core.io.AbstractCloseable
protected void finalize() throws Throwable
public void registerSubscriber(@NotNull @NotNull Subscriber<? extends MapEvent<? super T,? super M>> subscriber)
MapView
Any given instance of a subscriber must at most be registered once with a DataGrid instance at any given time.
This method is asynchronous and the provided subscriber will be eligible for receiving events as some later unspecified time.
registerSubscriber
in interface MapView<T,M>
subscriber
- the subscriber to the subscription@NotNull public <E> @NotNull Asset createSubAsset(@NotNull @NotNull VanillaAsset vanillaAsset, String name, Class<E> valueType)
createSubAsset
in interface SubAssetFactory
public M putIfAbsent(@NotNull T key, M value)
putIfAbsent
in interface ConcurrentMap<T,M>
putIfAbsent
in interface Map<T,M>
public Asset asset()
public net.openhft.chronicle.queue.impl.RollingChronicleQueue underlying()
underlying
in interface Assetted<Object>
Copyright © 2021. All rights reserved.