コード例 #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
  /**
   * Responds to the node that requested the given valid tree.
   *
   * @param validator A locally generated validator
   * @param local localhost (parameterized for testing)
   */
  void respond(Validator validator, InetAddress local) {
    MessagingService ms = MessagingService.instance();

    try {
      Message message = TreeResponseVerbHandler.makeVerb(local, validator);
      logger.info("Sending AEService tree for " + validator.request);
      ms.sendOneWay(message, validator.request.endpoint);
    } catch (Exception e) {
      logger.error("Could not send valid tree for request " + validator.request, e);
    }
  }
コード例 #3
0
 public String sendRR(Message[] messages, EndPoint[] to, IAsyncCallback cb) {
   if (messages.length != to.length) {
     throw new IllegalArgumentException(
         "Number of messages and the number of endpoints need to be same.");
   }
   String groupId = GuidGenerator.guid();
   callbackMap_.put(groupId, cb);
   for (int i = 0; i < messages.length; ++i) {
     messages[i].setMessageId(groupId);
     sendOneWay(messages[i], to[i]);
   }
   return groupId;
 }
コード例 #4
0
  public IAsyncResult sendRR(Message[] messages, EndPoint[] to) {
    if (messages.length != to.length) {
      throw new IllegalArgumentException(
          "Number of messages and the number of endpoints need to be same.");
    }

    IAsyncResult iar = new MultiAsyncResult(messages.length);
    String groupId = GuidGenerator.guid();
    taskCompletionMap_.put(groupId, iar);
    for (int i = 0; i < messages.length; ++i) {
      messages[i].setMessageId(groupId);
      sendOneWay(messages[i], to[i]);
    }

    return iar;
  }
コード例 #5
0
  /**
   * Responds to the node that requested the given valid tree.
   *
   * @param validator A locally generated validator
   * @param local localhost (parameterized for testing)
   */
  void respond(Validator validator, InetAddress local) {
    MessagingService ms = MessagingService.instance();

    try {
      Message message = TreeResponseVerbHandler.makeVerb(local, validator);
      if (!validator.request.endpoint.equals(FBUtilities.getBroadcastAddress()))
        logger.info(
            String.format(
                "[repair #%s] Sending completed merkle tree to %s for %s",
                validator.request.sessionid, validator.request.endpoint, validator.request.cf));
      ms.sendOneWay(message, validator.request.endpoint);
    } catch (Exception e) {
      logger.error(
          String.format(
              "[repair #%s] Error sending completed merkle tree to %s for %s ",
              validator.request.sessionid, validator.request.endpoint, validator.request.cf),
          e);
    }
  }
コード例 #6
0
  public String sendRR(Message[][] messages, EndPoint[][] to, IAsyncCallback cb) {
    if (messages.length != to.length) {
      throw new IllegalArgumentException(
          "Number of messages and the number of endpoints need to be same.");
    }

    int length = messages.length;
    String[] gids = new String[length];
    /* Generate the requisite GUID's */
    for (int i = 0; i < length; ++i) {
      gids[i] = GuidGenerator.guid();
    }
    /* attach this context to the callback */
    cb.attachContext(gids);
    for (int i = 0; i < length; ++i) {
      callbackMap_.put(gids[i], cb);
      for (int j = 0; j < messages[i].length; ++j) {
        messages[i][j].setMessageId(gids[i]);
        sendOneWay(messages[i][j], to[i][j]);
      }
    }
    return gids[0];
  }
コード例 #7
0
 public IAsyncResult sendRR(Message message, EndPoint to) {
   IAsyncResult iar = new AsyncResult();
   taskCompletionMap_.put(message.getMessageId(), iar);
   sendOneWay(message, to);
   return iar;
 }
コード例 #8
0
 public String sendRR(Message message, EndPoint to, IAsyncCallback cb) {
   String messageId = message.getMessageId();
   callbackMap_.put(messageId, cb);
   sendOneWay(message, to);
   return messageId;
 }