public abstract class MessageRunner<E> extends Object implements ExecutionCallback<ReadResultSet<ReliableTopicMessage>>
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 Ringbuffer<ReliableTopicMessage> |
ringbuffer |
Constructor and Description |
---|
MessageRunner(String id,
ReliableMessageListener<E> listener,
Ringbuffer<ReliableTopicMessage> ringbuffer,
String topicName,
int batchSze,
SerializationService serializationService,
Executor executor,
ConcurrentMap<String,MessageRunner<E>> runnersMap,
ILogger logger) |
Modifier and Type | Method and Description |
---|---|
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) |
boolean |
isCancelled() |
void |
next() |
void |
onFailure(Throwable t)
Called when an execution is completed with an error.
|
void |
onResponse(ReadResultSet<ReliableTopicMessage> result)
Called when an execution is completed successfully.
|
protected abstract void |
updateStatistics() |
protected final Ringbuffer<ReliableTopicMessage> ringbuffer
public MessageRunner(String id, ReliableMessageListener<E> listener, Ringbuffer<ReliableTopicMessage> ringbuffer, String topicName, int batchSze, SerializationService serializationService, Executor executor, ConcurrentMap<String,MessageRunner<E>> runnersMap, ILogger logger)
public void next()
public void onResponse(ReadResultSet<ReliableTopicMessage> result)
ExecutionCallback
onResponse
in interface ExecutionCallback<ReadResultSet<ReliableTopicMessage>>
result
- the result of the successful executionprotected abstract void updateStatistics()
protected abstract Member getMember(ReliableTopicMessage m)
public void onFailure(Throwable t)
ExecutionCallback
onFailure
in interface ExecutionCallback<ReadResultSet<ReliableTopicMessage>>
t
- the exception that is thrownprotected abstract Throwable adjustThrowable(Throwable t)
t
- throwableprotected abstract long getHeadSequence(StaleSequenceException staleSequenceException)
public void cancel()
public boolean isCancelled()
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.