Пример #1
0
 public String sendRR(Message message, EndPoint[] to, IAsyncCallback cb) {
   String messageId = message.getMessageId();
   callbackMap_.put(messageId, cb);
   for (int i = 0; i < to.length; ++i) {
     sendOneWay(message, to[i]);
   }
   return messageId;
 }
Пример #2
0
  public void sendUdpOneWay(Message message, EndPoint to) {
    EndPoint from = message.getFrom();
    if (message.getFrom().equals(to)) {
      MessagingService.receive(message);
      return;
    }

    UdpConnection connection = null;
    try {
      connection = new UdpConnection();
      connection.init();
      connection.write(message, to);
    } catch (IOException e) {
      logger_.warn(LogUtil.throwableToString(e));
    } finally {
      if (connection != null) connection.close();
    }
  }
Пример #3
0
  /*
      Use this version for fire and forget style messaging.
  */
  public void sendOneWay(Message message, EndPoint to) {
    // do local deliveries
    if (message.getFrom().equals(to)) {
      MessagingService.receive(message);
      return;
    }

    Runnable tcpWriteEvent = new MessageSerializationTask(message, to);
    messageSerializerExecutor_.execute(tcpWriteEvent);
  }
Пример #4
0
 public static void receive(Message message) {
   enqueueRunnable(message.getMessageType(), new MessageDeliveryTask(message));
 }
Пример #5
0
 public IAsyncResult sendRR(Message message, EndPoint to) {
   IAsyncResult iar = new AsyncResult();
   taskCompletionMap_.put(message.getMessageId(), iar);
   sendOneWay(message, to);
   return iar;
 }
Пример #6
0
 public String sendRR(Message message, EndPoint to, IAsyncCallback cb) {
   String messageId = message.getMessageId();
   callbackMap_.put(messageId, cb);
   sendOneWay(message, to);
   return messageId;
 }