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,acquirePermit()
simply returns and a new test is scheduled byScheduler.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
acquirePermit()
Acquires a permit from this balancer, blocking until one is available.void
releaseAllPermits()
void
releasePermit()
Releases a permit, returning it to the balancer.
-
-
-
Method Detail
-
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()
-
-