Interface Balancer
public interface Balancer
The Balancer controls the maximum of concurrent threads in the current Scheduler(s) and prevents
from own thread resources exhaustion if other group of schedulers share the same pool of threads.
If a permit is available,
If a permit is available,
acquirePermit()
simply returns and a new test is scheduled
by Scheduler.schedule(Runnable)
in the current runner. Otherwise waiting for a release.
One permit is released as soon as the child thread has finished.- Since:
- 2.16
- Author:
- Tibor Digana (tibor17)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Acquires a permit from this balancer, blocking until one is available.void
void
Releases a permit, returning it to the balancer.
-
Method Details
-
acquirePermit
boolean acquirePermit()Acquires a permit from this balancer, blocking until one is available.- Returns:
true
if current thread is NOT interrupted while waiting for a permit.
-
releasePermit
void releasePermit()Releases a permit, returning it to the balancer. -
releaseAllPermits
void releaseAllPermits()
-