本文整理了Java中java.util.concurrent.ScheduledFuture.isDone()
方法的一些代码示例,展示了ScheduledFuture.isDone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledFuture.isDone()
方法的具体详情如下:
包路径:java.util.concurrent.ScheduledFuture
类名称:ScheduledFuture
方法名:isDone
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
public boolean isDone() {
synchronized (this.triggerContextMonitor) {
return obtainCurrentFuture().isDone();
}
}
代码示例来源:origin: codecentric/spring-boot-admin
public void stopRegisterTask() {
if (scheduledTask != null && !scheduledTask.isDone()) {
scheduledTask.cancel(true);
LOGGER.debug("Canceled registration task");
}
}
代码示例来源:origin: igniterealtime/Openfire
/**
* Stop periodically checking the plugin directory.
*/
public void stopMonitoring()
{
if ( monitorTaskScheduledFuture != null && !monitorTaskScheduledFuture.isDone() )
{
// Cancel, with an interrupt if this task has been cancelled before.
monitorTaskScheduledFuture.cancel( monitorTaskScheduledFuture.isCancelled() );
}
}
代码示例来源:origin: codecentric/spring-boot-admin
public void startRegisterTask() {
if (scheduledTask != null && !scheduledTask.isDone()) {
return;
}
scheduledTask = taskScheduler.scheduleAtFixedRate(registrator::register, registerPeriod);
LOGGER.debug("Scheduled registration task for every {}ms", registerPeriod);
}
代码示例来源:origin: org.springframework/spring-context
@Override
public boolean isDone() {
synchronized (this.triggerContextMonitor) {
return obtainCurrentFuture().isDone();
}
}
代码示例来源:origin: alibaba/Sentinel
/**
* Start the scan task for long-idle connections.
*/
private synchronized void startScan() {
if (scanTaskFuture == null
|| scanTaskFuture.isCancelled()
|| scanTaskFuture.isDone()) {
scanTaskFuture = TIMER.scheduleAtFixedRate(
new ScanIdleConnectionTask(this), 10, 30, TimeUnit.SECONDS);
}
}
代码示例来源:origin: apache/hbase
@InterfaceAudience.Private
@Override
public synchronized boolean isChoreScheduled(ScheduledChore chore) {
return chore != null && scheduledChores.containsKey(chore)
&& !scheduledChores.get(chore).isDone();
}
代码示例来源:origin: traccar/traccar
public void scheduleReconnect() {
if (reconnectionTask == null || reconnectionTask.isDone()) {
reconnectionTask = reconnectionExecutor.scheduleWithFixedDelay(
new ReconnectionTask(this),
reconnectionDelay, reconnectionDelay, TimeUnit.MILLISECONDS);
}
}
代码示例来源:origin: com.zaxxer/HikariCP
Connection close()
{
ScheduledFuture<?> eol = endOfLife;
if (eol != null && !eol.isDone() && !eol.cancel(false)) {
LOGGER.warn("{} - maxLifeTime expiration task cancellation unexpectedly returned false for connection {}", getPoolName(), connection);
}
Connection con = connection;
connection = null;
endOfLife = null;
return con;
}
代码示例来源:origin: apache/storm
private void checkFailures() {
if (executorFuture != null && executorFuture.isDone()) {
try {
executorFuture.get();
} catch (InterruptedException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex);
} catch (ExecutionException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex.getCause());
}
}
}
代码示例来源:origin: apache/storm
private void checkFailures() {
if (executorFuture != null && executorFuture.isDone()) {
try {
executorFuture.get();
} catch (InterruptedException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex);
} catch (ExecutionException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex.getCause());
}
}
}
代码示例来源:origin: alibaba/jstorm
private void checkFailures() {
if (executorFuture != null && executorFuture.isDone()) {
try {
executorFuture.get();
} catch (InterruptedException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex);
} catch (ExecutionException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex.getCause());
}
}
}
代码示例来源:origin: alibaba/jstorm
private void checkFailures() {
if (executorFuture != null && executorFuture.isDone()) {
try {
executorFuture.get();
} catch (InterruptedException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex);
} catch (ExecutionException ex) {
LOG.error("Got exception ", ex);
throw new FailedException(ex.getCause());
}
}
}
代码示例来源:origin: AxonFramework/AxonFramework
private synchronized void scheduleReconnect(boolean immediate) {
if( !shutdown && (reconnectTask == null || reconnectTask.isDone())) {
if( channel != null) {
try {
channel.shutdownNow().awaitTermination(1, TimeUnit.SECONDS);
} catch(Exception ignored) {
}
}
channel = null;
reconnectTask = scheduler.schedule(this::tryReconnect, immediate ? 100 : 5000, TimeUnit.MILLISECONDS);
}
}
代码示例来源:origin: neo4j/neo4j
@Override
protected synchronized void after()
{
if ( null != thunk && !thunk.isDone() )
{
thunk.cancel( true );
}
thunk = null;
super.after();
}
代码示例来源:origin: redisson/redisson
private void scheduleTimeout(final ChannelHandlerContext ctx, final ChannelPromise promise) {
// Schedule a timeout.
final WriteTimeoutTask task = new WriteTimeoutTask(ctx, promise);
task.scheduledFuture = ctx.executor().schedule(task, timeoutNanos, TimeUnit.NANOSECONDS);
if (!task.scheduledFuture.isDone()) {
addWriteTimeoutTask(task);
// Cancel the scheduled timeout if the flush promise is complete.
promise.addListener(task);
}
}
代码示例来源:origin: AxonFramework/AxonFramework
private void checkConnectionState() {
if (shutdown) {
throw new AxonServerException(ErrorCode.CONNECTION_FAILED.errorCode(), "Shutdown in progress");
}
if (reconnectTask != null && !reconnectTask.isDone()) {
throw new AxonServerException(ErrorCode.CONNECTION_FAILED.errorCode(),
"No connection to AxonServer available");
}
}
代码示例来源:origin: google/guava
public void testNoOpScheduledExecutor() throws InterruptedException {
taskDone = false;
Runnable task =
new Runnable() {
@Override
public void run() {
taskDone = true;
}
};
ScheduledFuture<?> future =
TestingExecutors.noOpScheduledExecutor().schedule(task, 10, TimeUnit.MILLISECONDS);
Thread.sleep(20);
assertFalse(taskDone);
assertFalse(future.isDone());
}
代码示例来源:origin: wildfly/wildfly
private void scheduleTimeout(final ChannelHandlerContext ctx, final ChannelPromise promise) {
// Schedule a timeout.
final WriteTimeoutTask task = new WriteTimeoutTask(ctx, promise);
task.scheduledFuture = ctx.executor().schedule(task, timeoutNanos, TimeUnit.NANOSECONDS);
if (!task.scheduledFuture.isDone()) {
addWriteTimeoutTask(task);
// Cancel the scheduled timeout if the flush promise is complete.
promise.addListener(task);
}
}
代码示例来源:origin: google/guava
public void testServiceStartStop() throws Exception {
NullService service = new NullService();
service.startAsync().awaitRunning();
assertFalse(future.isDone());
service.stopAsync().awaitTerminated();
assertTrue(future.isCancelled());
}
内容来源于网络,如有侵权,请联系作者删除!