Beispiel #1
0
  private static void killTimeoutThread(
      ThreadContext context, Future timeoutFuture, AtomicBoolean latch) {
    if (latch.compareAndSet(false, true) && timeoutFuture.cancel(false)) {
      // ok, exception will not fire
      if (timeoutExecutor instanceof ScheduledThreadPoolExecutor
          && timeoutFuture instanceof Runnable) {
        ((ScheduledThreadPoolExecutor) timeoutExecutor).remove((Runnable) timeoutFuture);
      }
    } else {
      // future is not cancellable, wait for it to run and then poll
      try {
        timeoutFuture.get();
      } catch (ExecutionException ex) {
      } catch (InterruptedException ex) {
      }

      // poll to propagate exception from child thread
      context.pollThreadEvents();
    }
  }
 @Deprecated
 public boolean removeGeneral(RunnableScheduledFuture<?> r) {
   return _generalScheduledThreadPool.remove(r);
 }
 @Deprecated
 public boolean removeEffect(RunnableScheduledFuture<?> r) {
   return _effectsScheduledThreadPool.remove(r);
 }