Class StartupCountdown

java.lang.Object
org.jboss.as.ee.component.deployers.StartupCountdown

public final class StartupCountdown extends Object
Countdown tracker with capabilities similar to SE CountDownLatch, but allowing threads to mark and unmark themselves as privileged. Privileged threads, when entering await method, will immediately proceed without checking latch's state. This reentrant behaviour allows to work around situations where there is a possibility of a deadlock.
Author:
Fedor Gavrilov
  • Constructor Details

    • StartupCountdown

      public StartupCountdown(int count)
  • Method Details

    • countDown

      public void countDown()
    • countUp

      public void countUp(int count)
    • await

      public void await() throws InterruptedException
      Throws:
      InterruptedException
    • addCallback

      public void addCallback(Runnable callback)
      Executes a lightweight action when the countdown reaches 0. If StartupCountdown is not at zero when the method is called, passed callback will be executed by the last thread to call countDown. If StartupCountdown is at zero already, passed callback will be executed immediately by the caller thread.
      Parameters:
      callback - to execute. Should not be null.
    • isPrivileged

      public boolean isPrivileged()
    • enter

      public StartupCountdown.Frame enter()
    • current

      public static StartupCountdown.Frame current()
    • restore

      public static void restore(StartupCountdown.Frame frame)