gpt4 book ai didi

org.elasticsearch.discovery.zen.ZenDiscovery.rejoin()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 03:17:31 28 4
gpt4 key购买 nike

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

ZenDiscovery.rejoin介绍

暂无

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

private void submitRejoin(String source) {
  synchronized (stateMutex) {
    rejoin(source);
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/** cleans any running joining thread and calls {@link #rejoin} */
public void stopRunningThreadAndRejoin(String reason) {
  assert Thread.holdsLock(stateMutex);
  currentJoinThread.set(null);
  rejoin(reason);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
  public void messageReceived(final RejoinClusterRequest request, final TransportChannel channel) throws Exception {
    try {
      channel.sendResponse(TransportResponse.Empty.INSTANCE);
    } catch (Exception e) {
      logger.warn("failed to send response on rejoin cluster request handling", e);
    }
    synchronized (stateMutex) {
      rejoin("received a request to rejoin the cluster from [" + request.fromNodeId + "]");
    }
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleMinimumMasterNodesChanged(final int minimumMasterNodes) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a node failure
    return;
  }
  final int prevMinimumMasterNode = ZenDiscovery.this.electMaster.minimumMasterNodes();
  ZenDiscovery.this.electMaster.minimumMasterNodes(minimumMasterNodes);
  if (!localNodeMaster()) {
    // We only set the new value. If the master doesn't see enough nodes it will revoke it's mastership.
    return;
  }
  synchronized (stateMutex) {
    // check if we have enough master nodes, if not, we need to move into joining the cluster again
    if (!electMaster.hasEnoughMasterNodes(committedState.get().nodes())) {
      rejoin("not enough master nodes on change of minimum_master_nodes from [" + prevMinimumMasterNode + "] to [" +
        minimumMasterNodes + "]");
    }
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleMasterGone(final DiscoveryNode masterNode, final Throwable cause, final String reason) {
  if (lifecycleState() != Lifecycle.State.STARTED) {
    // not started, ignore a master failure
    return;
  }
  if (localNodeMaster()) {
    // we might get this on both a master telling us shutting down, and then the disconnect failure
    return;
  }
  logger.info(() -> new ParameterizedMessage("master_left [{}], reason [{}]", masterNode, reason), cause);
  synchronized (stateMutex) {
    if (localNodeMaster() == false && masterNode.equals(committedState.get().nodes().getMasterNode())) {
      // flush any pending cluster states from old master, so it will not be set as master again
      pendingStatesQueue.failAllStatesAndClear(new ElasticsearchException("master left [{}]", reason));
      rejoin("master left (reason = " + reason + ")");
    }
  }
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private void handleAnotherMaster(ClusterState localClusterState, final DiscoveryNode otherMaster, long otherClusterStateVersion,
                 String reason) {
  assert localClusterState.nodes().isLocalNodeElectedMaster() : "handleAnotherMaster called but current node is not a master";
  assert Thread.holdsLock(stateMutex);
  if (otherClusterStateVersion > localClusterState.version()) {
    rejoin("zen-disco-discovered another master with a new cluster_state [" + otherMaster + "][" + reason + "]");
  } else {
    // TODO: do this outside mutex
    logger.warn("discovered [{}] which is also master but with an older cluster_state, telling [{}] to rejoin the cluster ([{}])",
      otherMaster, otherMaster, reason);
    try {
      // make sure we're connected to this node (connect to node does nothing if we're already connected)
      // since the network connections are asymmetric, it may be that we received a state but have disconnected from the node
      // in the past (after a master failure, for example)
      transportService.connectToNode(otherMaster);
      transportService.sendRequest(otherMaster, DISCOVERY_REJOIN_ACTION_NAME,
        new RejoinClusterRequest(localClusterState.nodes().getLocalNodeId()),
        new EmptyTransportResponseHandler(ThreadPool.Names.SAME) {
        @Override
        public void handleException(TransportException exp) {
          logger.warn(() -> new ParameterizedMessage("failed to send rejoin request to [{}]", otherMaster), exp);
        }
      });
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to send rejoin request to [{}]", otherMaster), e);
    }
  }
}

代码示例来源:origin: harbby/presto-connectors

@Override
  public ClusterState apply(ClusterState clusterState, String reason) {
    return ZenDiscovery.this.rejoin(clusterState, reason);
  }
}, logger);

代码示例来源:origin: org.elasticsearch/elasticsearch

new ElasticsearchException("failed to publish cluster state"));
rejoin("zen-disco-failed-to-publish");

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

private void submitRejoin(String source) {
  synchronized (stateMutex) {
    rejoin(source);
  }
}

代码示例来源:origin: apache/servicemix-bundles

private void submitRejoin(String source) {
  synchronized (stateMutex) {
    rejoin(source);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/** cleans any running joining thread and calls {@link #rejoin} */
public void stopRunningThreadAndRejoin(String reason) {
  assert Thread.holdsLock(stateMutex);
  currentJoinThread.set(null);
  rejoin(reason);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
  public void messageReceived(final RejoinClusterRequest request, final TransportChannel channel) throws Exception {
    try {
      channel.sendResponse(TransportResponse.Empty.INSTANCE);
    } catch (Exception e) {
      logger.warn("failed to send response on rejoin cluster request handling", e);
    }
    synchronized (stateMutex) {
      rejoin("received a request to rejoin the cluster from [" + request.fromNodeId + "]");
    }
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public ClusterTasksResult<LocalClusterUpdateTask> execute(ClusterState currentState) {
  try {
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
  } catch (Exception e) {
    logger.warn("failed to send response on rejoin cluster request handling", e);
  }
  return rejoin(currentState, "received a request to rejoin the cluster from [" + request.fromNodeId + "]");
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/** cleans any running joining thread and calls {@link #rejoin} */
public ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask> stopRunningThreadAndRejoin(ClusterState clusterState, String reason) {
  ClusterService.assertClusterStateThread();
  currentJoinThread.set(null);
  return rejoin(clusterState, reason);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
  public void messageReceived(final RejoinClusterRequest request, final TransportChannel channel) throws Exception {
    try {
      channel.sendResponse(TransportResponse.Empty.INSTANCE);
    } catch (Exception e) {
      logger.warn("failed to send response on rejoin cluster request handling", e);
    }
    synchronized (stateMutex) {
      rejoin("received a request to rejoin the cluster from [" + request.fromNodeId + "]");
    }
  }
}

代码示例来源:origin: harbby/presto-connectors

/** cleans any running joining thread and calls {@link #rejoin} */
public ClusterState stopRunningThreadAndRejoin(ClusterState clusterState, String reason) {
  assertClusterStateThread();
  currentJoinThread.set(null);
  return rejoin(clusterState, reason);
}

代码示例来源:origin: harbby/presto-connectors

@Override
public ClusterState execute(ClusterState currentState) {
  // check if we have enough master nodes, if not, we need to move into joining the cluster again
  if (!electMaster.hasEnoughMasterNodes(currentState.nodes())) {
    return rejoin(currentState, "not enough master nodes on change of minimum_master_nodes from [" + prevMinimumMasterNode + "] to [" + minimumMasterNodes + "]");
  }
  return currentState;
}

代码示例来源:origin: harbby/presto-connectors

@Override
public ClusterState execute(ClusterState currentState) {
  try {
    channel.sendResponse(TransportResponse.Empty.INSTANCE);
  } catch (Exception e) {
    logger.warn("failed to send response on rejoin cluster request handling", e);
  }
  return rejoin(currentState, "received a request to rejoin the cluster from [" + request.fromNodeId + "]");
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public ClusterTasksResult<LocalClusterUpdateTask> execute(ClusterState currentState) {
  // check if we have enough master nodes, if not, we need to move into joining the cluster again
  if (!electMaster.hasEnoughMasterNodes(currentState.nodes())) {
    return rejoin(currentState, "not enough master nodes on change of minimum_master_nodes from [" + prevMinimumMasterNode + "] to [" + minimumMasterNodes + "]");
  }
  return unchanged();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
public ClusterTasksResult<LocalClusterUpdateTask> execute(ClusterState currentState) {
  if (!masterNode.equals(currentState.nodes().getMasterNode())) {
    // master got switched on us, no need to send anything
    return unchanged();
  }
  // flush any pending cluster states from old master, so it will not be set as master again
  publishClusterState.pendingStatesQueue().failAllStatesAndClear(new ElasticsearchException("master left [{}]", reason));
  return rejoin(currentState, "master left (reason = " + reason + ")");
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com