long timeoutID,
Handler<AsyncResult<Message<T>>> asyncResultHandler,
Handler<Message<T>> replyHandler) {
if (message.send()) {
// Choose one
ServerID sid = subs.choose();
if (!sid.equals(serverID)) { //We don't send to this node
sendRemote(sid, message);
} else {
receiveMessage(message, timeoutID, asyncResultHandler, replyHandler);
}
} else {
// Publish
for (ServerID sid : subs) {
if (!sid.equals(serverID)) { //We don't send to this node
sendRemote(sid, message);
} else {
receiveMessage(message, timeoutID, null, replyHandler);
}
}