Class FutureDisposable

  • All Implemented Interfaces:
    Disposable, java.io.Serializable

    final class FutureDisposable
    extends java.util.concurrent.atomic.AtomicReference<java.util.concurrent.Future<?>>
    implements Disposable
    A Disposable container that cancels a Future instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      FutureDisposable​(java.util.concurrent.Future<?> run, boolean allowInterrupt)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Dispose the resource, the operation should be idempotent.
      boolean isDisposed()
      Returns true if this resource has been disposed.
      • Methods inherited from class java.util.concurrent.atomic.AtomicReference

        accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, toString, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • allowInterrupt

        private final boolean allowInterrupt
    • Constructor Detail

      • FutureDisposable

        FutureDisposable​(java.util.concurrent.Future<?> run,
                         boolean allowInterrupt)
    • Method Detail

      • isDisposed

        public boolean isDisposed()
        Description copied from interface: Disposable
        Returns true if this resource has been disposed.
        Specified by:
        isDisposed in interface Disposable
        Returns:
        true if this resource has been disposed
      • dispose

        public void dispose()
        Description copied from interface: Disposable
        Dispose the resource, the operation should be idempotent.
        Specified by:
        dispose in interface Disposable