org.elasticsearch.cluster.ClusterState.getBlocks()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(88)

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

ClusterState.getBlocks介绍

暂无

代码示例

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

void handleJoinRequest(final DiscoveryNode node, final ClusterState state, final MembershipAction.JoinCallback callback) {
  if (nodeJoinController == null) {
    throw new IllegalStateException("discovery module is not yet started");
  } else {
    // we do this in a couple of places including the cluster update thread. This one here is really just best effort
    // to ensure we fail as fast as possible.
    onJoinValidators.stream().forEach(a -> a.accept(node, state));
    if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
      MembershipAction.ensureMajorVersionBarrier(node.getVersion(), state.getNodes().getMinNodeVersion());
    }
    // try and connect to the node, if it fails, we can raise an exception back to the client...
    transportService.connectToNode(node);
    // validate the join request, will throw a failure if it fails, which will get back to the
    // node calling the join request
    try {
      membership.sendValidateJoinRequestBlocking(node, state, joinTimeout);
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to validate incoming join request from node [{}]", node),
        e);
      callback.onFailure(new IllegalStateException("failure when sending a validation request to node", e));
      return;
    }
    nodeJoinController.handleJoinRequest(node, callback);
  }
}

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

@Override
  protected void doExecute(MainRequest request, ActionListener<MainResponse> listener) {
    ClusterState clusterState = clusterService.state();
    final boolean available = clusterState.getBlocks().hasGlobalBlock(RestStatus.SERVICE_UNAVAILABLE) == false;
    listener.onResponse(
      new MainResponse(nodeName, Version.CURRENT, clusterState.getClusterName(),
          clusterState.metaData().clusterUUID(), Build.CURRENT, available));
  }
}

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

reroute();
indicesToMarkReadOnly.removeIf(index -> state.getBlocks().indexBlocked(ClusterBlockLevel.WRITE, index));
if (indicesToMarkReadOnly.isEmpty() == false) {
  markIndicesReadOnly(indicesToMarkReadOnly);

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

Version maxClusterNodeVersion = newState.nodes().getMaxNodeVersion();
final boolean enforceMajorVersion = currentState.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false;

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

void handleJoinRequest(final DiscoveryNode node, final ClusterState state, final MembershipAction.JoinCallback callback) {
  if (nodeJoinController == null) {
    throw new IllegalStateException("discovery module is not yet started");
  } else {
    // we do this in a couple of places including the cluster update thread. This one here is really just best effort
    // to ensure we fail as fast as possible.
    onJoinValidators.stream().forEach(a -> a.accept(node, state));
    if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
      MembershipAction.ensureMajorVersionBarrier(node.getVersion(), state.getNodes().getMinNodeVersion());
    }
    // try and connect to the node, if it fails, we can raise an exception back to the client...
    transportService.connectToNode(node);
    // validate the join request, will throw a failure if it fails, which will get back to the
    // node calling the join request
    try {
      membership.sendValidateJoinRequestBlocking(node, state, joinTimeout);
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to validate incoming join request from node [{}]", node),
        e);
      callback.onFailure(new IllegalStateException("failure when sending a validation request to node", e));
      return;
    }
    nodeJoinController.handleJoinRequest(node, callback);
  }
}

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

void handleJoinRequest(final DiscoveryNode node, final ClusterState state, final MembershipAction.JoinCallback callback) {
  if (nodeJoinController == null) {
    throw new IllegalStateException("discovery module is not yet started");
  } else {
    // we do this in a couple of places including the cluster update thread. This one here is really just best effort
    // to ensure we fail as fast as possible.
    onJoinValidators.stream().forEach(a -> a.accept(node, state));
    if (state.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
      MembershipAction.ensureMajorVersionBarrier(node.getVersion(), state.getNodes().getMinNodeVersion());
    }
    // try and connect to the node, if it fails, we can raise an exception back to the client...
    transportService.connectToNode(node);
    // validate the join request, will throw a failure if it fails, which will get back to the
    // node calling the join request
    try {
      membership.sendValidateJoinRequestBlocking(node, state, joinTimeout);
    } catch (Exception e) {
      logger.warn(() -> new ParameterizedMessage("failed to validate incoming join request from node [{}]", node),
        e);
      callback.onFailure(new IllegalStateException("failure when sending a validation request to node", e));
      return;
    }
    nodeJoinController.handleJoinRequest(node, callback);
  }
}

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

reroute();
indicesToMarkReadOnly.removeIf(index -> state.getBlocks().indexBlocked(ClusterBlockLevel.WRITE, index));
if (indicesToMarkReadOnly.isEmpty() == false) {
  markIndicesReadOnly(indicesToMarkReadOnly);

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

reroute();
indicesToMarkReadOnly.removeIf(index -> state.getBlocks().indexBlocked(ClusterBlockLevel.WRITE, index));
if (indicesToMarkReadOnly.isEmpty() == false) {
  markIndicesReadOnly(indicesToMarkReadOnly);

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

@Override
  protected void doExecute(MainRequest request, ActionListener<MainResponse> listener) {
    ClusterState clusterState = clusterService.state();
    assert Node.NODE_NAME_SETTING.exists(settings);
    final boolean available = clusterState.getBlocks().hasGlobalBlock(RestStatus.SERVICE_UNAVAILABLE) == false;
    listener.onResponse(
      new MainResponse(Node.NODE_NAME_SETTING.get(settings), Version.CURRENT, clusterState.getClusterName(),
          clusterState.metaData().clusterUUID(), Build.CURRENT, available));
  }
}

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

@Override
  protected void doExecute(MainRequest request, ActionListener<MainResponse> listener) {
    ClusterState clusterState = clusterService.state();
    assert Node.NODE_NAME_SETTING.exists(settings);
    final boolean available = clusterState.getBlocks().hasGlobalBlock(RestStatus.SERVICE_UNAVAILABLE) == false;
    listener.onResponse(
      new MainResponse(Node.NODE_NAME_SETTING.get(settings), Version.CURRENT, clusterState.getClusterName(),
          clusterState.metaData().clusterUUID(), Build.CURRENT, available));
  }
}

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

@Override
  protected void doExecute(MainRequest request, ActionListener<MainResponse> listener) {
    ClusterState clusterState = clusterService.state();
    assert Node.NODE_NAME_SETTING.exists(settings);
    final boolean available = clusterState.getBlocks().hasGlobalBlock(RestStatus.SERVICE_UNAVAILABLE) == false;
    listener.onResponse(
      new MainResponse(Node.NODE_NAME_SETTING.get(settings), Version.CURRENT, clusterState.getClusterName(),
          clusterState.metaData().clusterUUID(), Build.CURRENT, available));
  }
}

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

Version maxClusterNodeVersion = newState.nodes().getMaxNodeVersion();
final boolean enforceMajorVersion = currentState.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false;

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

Version maxClusterNodeVersion = newState.nodes().getMaxNodeVersion();
final boolean enforceMajorVersion = currentState.getBlocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false;

相关文章