public abstract class MessageRunner<E> extends Object implements BiConsumer<ReadResultSet<ReliableTopicMessage>,Throwable>
ExecutionCallback
that will try to read an
item from the ringbuffer or blocks if no item is available. All data
that are read is pushed into the MessageListener
.
It is a self-perpetuating stream of async calls.
The runner keeps track of the sequence.
Modifier and Type | Field and Description |
---|---|
protected ReliableMessageListener<E> |
listener |
protected ILogger |
logger |
protected Ringbuffer<ReliableTopicMessage> |
ringbuffer |
protected long |
sequence |
protected String |
topicName |
Constructor and Description |
---|
MessageRunner(UUID id,
ReliableMessageListener<E> listener,
Ringbuffer<ReliableTopicMessage> ringbuffer,
String topicName,
int batchSze,
SerializationService serializationService,
Executor executor,
ConcurrentMap<UUID,MessageRunner<E>> runnersMap,
ILogger logger) |
Modifier and Type | Method and Description |
---|---|
void |
accept(ReadResultSet<ReliableTopicMessage> result,
Throwable throwable) |
protected abstract Throwable |
adjustThrowable(Throwable t)
Needed because client / server behaviour is different on onFailure call
|
void |
cancel() |
protected abstract long |
getHeadSequence(StaleSequenceException staleSequenceException) |
protected abstract Member |
getMember(ReliableTopicMessage m) |
protected boolean |
handleInternalException(Throwable t) |
boolean |
isCancelled() |
void |
next() |
protected abstract void |
updateStatistics() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen
protected final Ringbuffer<ReliableTopicMessage> ringbuffer
protected final ILogger logger
protected final ReliableMessageListener<E> listener
protected final String topicName
protected long sequence
public MessageRunner(UUID id, ReliableMessageListener<E> listener, Ringbuffer<ReliableTopicMessage> ringbuffer, String topicName, int batchSze, SerializationService serializationService, Executor executor, ConcurrentMap<UUID,MessageRunner<E>> runnersMap, ILogger logger)
public void next()
public void accept(ReadResultSet<ReliableTopicMessage> result, Throwable throwable)
accept
in interface BiConsumer<ReadResultSet<ReliableTopicMessage>,Throwable>
protected abstract void updateStatistics()
protected abstract Member getMember(ReliableTopicMessage m)
protected boolean handleInternalException(Throwable t)
t
- throwable to check if it is terminal or can be handled so that topic can continueprotected abstract Throwable adjustThrowable(Throwable t)
t
- throwableprotected abstract long getHeadSequence(StaleSequenceException staleSequenceException)
public void cancel()
public boolean isCancelled()
Copyright © 2019 Hazelcast, Inc.. All rights reserved.