org.elasticsearch.common.component.Lifecycle.stopped()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(64)

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

Lifecycle.stopped介绍

[英]Returns true if the state is stopped.
[中]如果状态已停止,则返回true。

代码示例

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

@Override
public void close() {
  if (isClosing.compareAndSet(false, true)) {
    try {
      boolean block = lifecycle.stopped() && Transports.isTransportThread(Thread.currentThread()) == false;
      CloseableChannel.closeChannels(channels, block);
    } finally {
      // Call the super method to trigger listeners
      super.close();
    }
  }
}

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

protected void performReroute(String reason) {
  try {
    if (lifecycle.stopped()) {
      return;

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

@Override
public void close() {
  if (isClosing.compareAndSet(false, true)) {
    try {
      if (lifecycle.stopped()) {
        /* We set SO_LINGER timeout to 0 to ensure that when we shutdown the node we don't
         * have a gazillion connections sitting in TIME_WAIT to free up resources quickly.
         * This is really the only part where we close the connection from the server side
         * otherwise the client (node) initiates the TCP closing sequence which doesn't cause
         * these issues. Setting this by default from the beginning can have unexpected
         * side-effects an should be avoided, our protocol is designed in a way that clients
         * close connection which is how it should be*/
        channels.forEach(c -> {
          try {
            c.setSoLinger(0);
          } catch (IOException e) {
            logger.warn(new ParameterizedMessage("unexpected exception when setting SO_LINGER on channel {}", c), e);
          }
        });
      }
      boolean block = lifecycle.stopped() && Transports.isTransportThread(Thread.currentThread()) == false;
      TcpChannel.closeChannels(channels, block);
    } finally {
      // Call the super method to trigger listeners
      super.close();
    }
  }
}

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

protected void performReroute(String reason) {
  try {
    if (lifecycle.stopped()) {
      return;

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

protected void performReroute(String reason) {
  try {
    if (lifecycle.stopped()) {
      return;

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

protected void performReroute(String reason) {
  try {
    if (lifecycle.stopped()) {
      return;

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

protected void performReroute(final String reason) {
  try {
    if (lifecycle.stopped()) {
      return;

相关文章