com.hazelcast.instance.Node.createJoinRequest()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中com.hazelcast.instance.Node.createJoinRequest()方法的一些代码示例,展示了Node.createJoinRequest()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.createJoinRequest()方法的具体详情如下:
包路径:com.hazelcast.instance.Node
类名称:Node
方法名:createJoinRequest

Node.createJoinRequest介绍

暂无

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet

private Address findMasterWithMulticast() {
  try {
    if (logger.isFineEnabled()) {
      logger.fine("Searching for master node. Max tries: " + maxTryCount.get());
    }
    JoinRequest joinRequest = node.createJoinRequest(false);
    while (node.isRunning() && currentTryCount.incrementAndGet() <= maxTryCount.get()) {
      joinRequest.setTryCount(currentTryCount.get());
      node.multicastService.send(joinRequest);
      Address masterAddress = clusterService.getMasterAddress();
      if (masterAddress == null) {
        //noinspection BusyWait
        Thread.sleep(getPublishInterval());
      } else {
        return masterAddress;
      }
    }
  } catch (final Exception e) {
    if (logger != null) {
      logger.warning(e);
    }
  } finally {
    currentTryCount.set(0);
  }
  return null;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private Address findMasterWithMulticast() {
  try {
    if (logger.isFineEnabled()) {
      logger.fine("Searching for master node. Max tries: " + maxTryCount.get());
    }
    JoinRequest joinRequest = node.createJoinRequest(false);
    while (node.isRunning() && currentTryCount.incrementAndGet() <= maxTryCount.get()) {
      joinRequest.setTryCount(currentTryCount.get());
      node.multicastService.send(joinRequest);
      Address masterAddress = clusterService.getMasterAddress();
      if (masterAddress == null) {
        //noinspection BusyWait
        Thread.sleep(getPublishInterval());
      } else {
        return masterAddress;
      }
    }
  } catch (final Exception e) {
    if (logger != null) {
      logger.warning(e);
    }
  } finally {
    currentTryCount.set(0);
  }
  return null;
}

代码示例来源:origin: hazelcast/hazelcast-jet

/**
 * Send join request to {@code toAddress}.
 *
 * @param toAddress       the currently known master address.
 * @param withCredentials use cluster credentials
 * @return {@code true} if join request was sent successfully, otherwise {@code false}.
 */
public boolean sendJoinRequest(Address toAddress, boolean withCredentials) {
  if (toAddress == null) {
    toAddress = clusterService.getMasterAddress();
  }
  JoinRequestOp joinRequest = new JoinRequestOp(node.createJoinRequest(withCredentials));
  return nodeEngine.getOperationService().send(joinRequest, toAddress);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

/**
 * Send join request to {@code toAddress}.
 *
 * @param toAddress       the currently known master address.
 * @param withCredentials use cluster credentials
 * @return {@code true} if join request was sent successfully, otherwise {@code false}.
 */
public boolean sendJoinRequest(Address toAddress, boolean withCredentials) {
  if (toAddress == null) {
    toAddress = clusterService.getMasterAddress();
  }
  JoinRequestOp joinRequest = new JoinRequestOp(node.createJoinRequest(withCredentials));
  return nodeEngine.getOperationService().send(joinRequest, toAddress);
}

相关文章

微信公众号

最新文章

更多