@ApplicationScoped public class AsynchronousManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
AsynchronousManager.AsynchronousCallEndCondition
Interface for Lambda used to define endcondition of call-loop
|
| Constructor and Description |
|---|
AsynchronousManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addMultipleHandler(Runnable runnable)
Register a Handler not called only once, so it should not get removed during call-loop.
|
void |
addOneTimeHandler(Runnable runnable)
Register a Handler only called once.
|
boolean |
doesEnqueAsynchronousCalls()
check if Asynchronous Methods may be dispatched
|
int |
once()
call all registered Runables just once.
|
int |
oneShotOnly()
call all registered Runables just once.
|
void |
setEnqueAsynchronousCalls(boolean enqueAsynchronousCalls1)
set if Asynchronous Methods should be dispatched
|
void |
startThread()
start Thread periodically calling asynchronous manager by itself, if not yet initialized,
|
void |
stopThread()
stop asynchronous handler thread.
|
boolean |
thereAreOnces() |
void |
until(AsynchronousManager.AsynchronousCallEndCondition predicate)
call the runnables until there are no more left or the predicate returns true.
|
void |
untilNothingLeft()
call the runnables until there are no more left this does not work when timer methods are registered.
|
public boolean doesEnqueAsynchronousCalls()
public void setEnqueAsynchronousCalls(boolean enqueAsynchronousCalls1)
enqueAsynchronousCalls1 - true, if they should be dispatched, false if they are to be executed immediately,
without AsynchronousManagerpublic void startThread()
public void stopThread()
public void addOneTimeHandler(Runnable runnable)
runnable - the code to be called. After the call, The Asynchronous Manager removes all references to this.public void addMultipleHandler(Runnable runnable)
runnable - the code to be called.public int once()
public int oneShotOnly()
public void until(AsynchronousManager.AsynchronousCallEndCondition predicate)
predicate - the condition, if true then end calling.public void untilNothingLeft()
public boolean thereAreOnces()
Copyright © 2017–2018. All rights reserved.