Class StartupCountdown
java.lang.Object
org.jboss.as.ee.component.deployers.StartupCountdown
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
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCallback(Runnable callback) Executes a lightweight action when the countdown reaches 0.voidawait()voidvoidcountUp(int count) static StartupCountdown.Framecurrent()enter()booleanstatic voidrestore(StartupCountdown.Frame frame)
-
Constructor Details
-
StartupCountdown
public StartupCountdown(int count)
-
-
Method Details
-
countDown
public void countDown() -
countUp
public void countUp(int count) -
await
- Throws:
InterruptedException
-
addCallback
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
-
current
-
restore
-