Class KernelRunner.FJSafeBarrier

  • All Implemented Interfaces:
    IKernelBarrier, java.util.concurrent.ForkJoinPool.ManagedBlocker
    Enclosing class:
    KernelRunner

    private static final class KernelRunner.FJSafeBarrier
    extends java.lang.Object
    implements IKernelBarrier
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.concurrent.atomic.AtomicBoolean brokenBarrier  
      (package private) java.util.concurrent.atomic.AtomicBoolean canceled  
      (package private) java.lang.Object lock  
      (package private) int remainingThreads  
      (package private) int threads  
    • Constructor Summary

      Constructors 
      Constructor Description
      FJSafeBarrier​(int threads)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean block()  
      void breakBarrier​(java.lang.Throwable e)
      Should be called by worker threads when a fatal exception occurs, so that all threads fail-fast and no deadlock occurs.
      void cancelBarrier()
      Cancels the barrier.
      boolean isReleasable()  
      • Methods inherited from class java.lang.Object

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

      • threads

        final int threads
      • brokenBarrier

        final java.util.concurrent.atomic.AtomicBoolean brokenBarrier
      • canceled

        final java.util.concurrent.atomic.AtomicBoolean canceled
      • lock

        final java.lang.Object lock
      • remainingThreads

        int remainingThreads
    • Constructor Detail

      • FJSafeBarrier

        FJSafeBarrier​(int threads)
    • Method Detail

      • breakBarrier

        public void breakBarrier​(java.lang.Throwable e)
        Should be called by worker threads when a fatal exception occurs, so that all threads fail-fast and no deadlock occurs.
        Specified by:
        breakBarrier in interface IKernelBarrier
      • cancelBarrier

        public void cancelBarrier()
        Description copied from interface: IKernelBarrier
        Cancels the barrier. All threads that may be waiting for the barrier are released and barrier is permanently disabled.
        Specified by:
        cancelBarrier in interface IKernelBarrier
      • block

        public boolean block()
                      throws java.lang.InterruptedException
        Specified by:
        block in interface java.util.concurrent.ForkJoinPool.ManagedBlocker
        Throws:
        java.lang.InterruptedException
      • isReleasable

        public boolean isReleasable()
        Specified by:
        isReleasable in interface java.util.concurrent.ForkJoinPool.ManagedBlocker