java.util.concurrent.ScheduledExecutorService.isShutdown()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(167)

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

ScheduledExecutorService.isShutdown介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

/**
 * {@inheritDoc}
 */
public boolean isAlive() {
  return !scheduledExecutorService.isShutdown();
}

代码示例来源:origin: redisson/redisson

/**
 * {@inheritDoc}
 */
public boolean isAlive() {
  return !scheduledExecutorService.isShutdown();
}

代码示例来源:origin: SonarSource/sonarqube

@Override
public boolean isShutdown() {
 return delegate.isShutdown();
}

代码示例来源:origin: runelite/runelite

@Override
public boolean isShutdown()
{
  return service.isShutdown();
}

代码示例来源:origin: mpusher/mpush

@Override
public boolean isRunning() {
  return executorService != null && !executorService.isShutdown();
}

代码示例来源:origin: reactor/reactor-core

@Override
public boolean isDisposed() {
  return executor.isShutdown();
}

代码示例来源:origin: weibocom/motan

@Override
  public void close() {
    if(!scheduledExecutor.isShutdown()){
      scheduledExecutor.shutdown();
    }
  }
});

代码示例来源:origin: weibocom/motan

@Override
  public void close() {
    if(!retryExecutor.isShutdown()){
      retryExecutor.shutdown();
    }
  }
});

代码示例来源:origin: weibocom/motan

@Override
  public void close() {
    if (!executorService.isShutdown()) {
      executorService.shutdown();
    }
  }
});

代码示例来源:origin: weibocom/motan

@Override
  public void close() {
    if(!scheduledExecutor.isShutdown()){
      scheduledExecutor.shutdown();
    }
  }
});

代码示例来源:origin: weibocom/motan

@Override
  public void close() {
    if (!executorService.isShutdown()) {
      executorService.shutdown();
    }
  }
});

代码示例来源:origin: apache/incubator-druid

@Override
public void run()
{
 while (!eventQueue.isEmpty() && !scheduler.isShutdown()) {
  OpentsdbEvent event = eventQueue.poll();
  events.add(event);
  if (events.size() >= flushThreshold) {
   sendEvents();
  }
 }
}

代码示例来源:origin: apache/hive

@Override
 public void run() {
  if (heartbeatExecutorService != null
    && !heartbeatExecutorService.isShutdown()
    && !heartbeatExecutorService.isTerminated()) {
   LOG.info("Shutting down Heartbeater thread pool.");
   heartbeatExecutorService.shutdown();
  }
 }
};

代码示例来源:origin: apache/incubator-gobblin

@Override
protected void startUp()
  throws Exception {
 LOG.info("Starting the task executor");
 if (this.taskExecutor.isShutdown() || this.taskExecutor.isTerminated()) {
  throw new IllegalStateException("Task thread pool executor is shutdown or terminated");
 }
 if (this.forkExecutor.isShutdown() || this.forkExecutor.isTerminated()) {
  throw new IllegalStateException("Fork thread pool executor is shutdown or terminated");
 }
}

代码示例来源:origin: apache/hbase

@Override
public void stop() {
 if (!getExecutor().isShutdown()) {
  getExecutor().shutdown();
 }
}

代码示例来源:origin: apache/storm

@Override
public void activate() {
  LOG.info("Start checking heartbeat...");
  // prevent timer to check heartbeat based on last thing before activate
  setHeartbeat();
  if (heartBeatExecutorService.isShutdown()) {
    //In case deactivate was called before
    heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1));
  }
  heartBeatExecutorService.scheduleAtFixedRate(new SpoutHeartbeatTimerTask(this), 1, 1, TimeUnit.SECONDS);
  this.sendSyncCommand("activate", "");
}

代码示例来源:origin: spring-projects/spring-security

@Test
public void isShutdown() {
  boolean result = executor.isShutdown();
  verify(delegate).isShutdown();
  assertThat(result).isEqualTo(delegate.isShutdown()).isNotNull();
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void isShutdown() {
 underTest.isShutdown();
 verify(executorService).isShutdown();
}

代码示例来源:origin: google/guava

public void testDefaultExecutorIsShutdownWhenServiceIsStopped() throws Exception {
 final AtomicReference<ScheduledExecutorService> executor = Atomics.newReference();
 AbstractScheduledService service =
   new AbstractScheduledService() {
    @Override
    protected void runOneIteration() throws Exception {}
    @Override
    protected ScheduledExecutorService executor() {
     executor.set(super.executor());
     return executor.get();
    }
    @Override
    protected Scheduler scheduler() {
     return newFixedDelaySchedule(0, 1, TimeUnit.MILLISECONDS);
    }
   };
 service.startAsync();
 assertFalse(service.executor().isShutdown());
 service.awaitRunning();
 service.stopAsync();
 service.awaitTerminated();
 assertTrue(executor.get().awaitTermination(100, TimeUnit.MILLISECONDS));
}

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * Tests the shutdown() method if the executor belongs to the semaphore. In
 * this case it has to be shut down.
 */
@Test
public void testShutdownOwnExecutor() {
  final TimedSemaphore semaphore = new TimedSemaphore(PERIOD, UNIT, LIMIT);
  semaphore.shutdown();
  assertTrue("Not shutdown", semaphore.isShutdown());
  assertTrue("Executor not shutdown", semaphore.getExecutorService()
      .isShutdown());
}

相关文章