Search in sources :

Example 1 with Message

use of org.neo4j.causalclustering.messaging.Message in project neo4j by neo4j.

the class DirectNetworking method processMessages.

public void processMessages() {
    while (messagesToBeProcessed()) {
        for (Map.Entry<MemberId, Queue<Message>> entry : messageQueues.entrySet()) {
            MemberId id = entry.getKey();
            Queue<Message> queue = entry.getValue();
            if (!queue.isEmpty()) {
                Message message = queue.remove();
                handlers.get(id).handle(message);
            }
        }
    }
}
Also used : MemberId(org.neo4j.causalclustering.identity.MemberId) Message(org.neo4j.causalclustering.messaging.Message) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Queue(java.util.Queue)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 Queue (java.util.Queue)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 MemberId (org.neo4j.causalclustering.identity.MemberId)1 Message (org.neo4j.causalclustering.messaging.Message)1