Beispiel #1
0
 private MessageFuture send(Message message) {
   Objects.requireNonNull(message);
   long id = ID.incrementAndGet();
   message.put(MESSAGE_ID, id);
   MessagePromise promise = new DefaultMessagePromise(message, remoteAddress);
   messageTracking.put(id, promise);
   clientHandler.sendMessage(promise);
   return promise;
 }
Beispiel #2
0
 @Override
 public void onMessage(MessageQueueLoop loop, Message message) {
   Number id = message.getNumber(CORRELATION_ID);
   MessagePromise promise;
   if (id == null || (promise = messageTracking.remove(id.longValue())) == null) {
     serverSentMessageNotifier.notify(message);
   } else {
     promise.setResponse(message);
   }
 }