@Named public final class DefaultQueryProcessor<T extends java.io.Serializable> extends java.lang.Object implements QueryProcessor<T>, CommunicationFacility
Modifier and Type | Field and Description |
---|---|
private NodeIdentityService |
identityService |
private static org.slf4j.Logger |
log |
private ReplicatedMap<java.lang.String,T> |
replicatedMap |
private WorkerCommunication |
workerCommunication |
Constructor and Description |
---|
DefaultQueryProcessor(NodeIdentityService identityService,
HazelcastInstance hazelcastInstance,
WorkerCommunication workerCommunication) |
Modifier and Type | Method and Description |
---|---|
private void |
destroy() |
<V extends java.io.Serializable> |
onMessage(WorkerMessage<V> workerMessage)
Handles a message.
|
java.util.stream.Stream<T> |
query()
Create a stream of objects to query.
|
void |
reset() |
void |
schedule(java.util.concurrent.Callable<T> callable)
Schedule a cache generator.
|
void |
start() |
java.util.Set<WorkerMessage.Type> |
subscribedTypes()
Returns a set of message types that this listener wants to subscribe to.
|
java.lang.String |
toString() |
private static final org.slf4j.Logger log
private final WorkerCommunication workerCommunication
private final NodeIdentityService identityService
private final ReplicatedMap<java.lang.String,T extends java.io.Serializable> replicatedMap
@Inject public DefaultQueryProcessor(NodeIdentityService identityService, HazelcastInstance hazelcastInstance, WorkerCommunication workerCommunication)
@PreDestroy private void destroy() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.util.stream.Stream<T> query()
QueryProcessor
Create a stream of objects to query.
query
in interface QueryProcessor<T extends java.io.Serializable>
public void schedule(java.util.concurrent.Callable<T> callable)
QueryProcessor
Schedule a cache generator.
schedule
in interface QueryProcessor<T extends java.io.Serializable>
callable
- callable that creates objects for future queries.public <V extends java.io.Serializable> boolean onMessage(WorkerMessage<V> workerMessage)
CommunicationFacility
Handles a message.
Only messages directed to this node will be passed with this method, so implementers do not need to check whether they are recipients.
onMessage
in interface CommunicationFacility
V
- a type of the payload.workerMessage
- a received message (for the current node).public java.util.Set<WorkerMessage.Type> subscribedTypes()
CommunicationFacility
Returns a set of message types that this listener wants to subscribe to.
subscribedTypes
in interface CommunicationFacility
public void start()
start
in interface CommunicationFacility
public void reset()
reset
in interface CommunicationFacility
public java.lang.String toString()
toString
in class java.lang.Object