T
- The type of the referencepublic interface ServiceReference<T>
Modifier and Type | Method and Description |
---|---|
T |
await()
Block until the service is available.
|
void |
executeWhenPresent(java.util.function.Predicate<T> run)
Queue a command to be executed after a service is registered.
|
Optional<T> |
ref()
Get the reference to the current state of this service.
|
Optional<T> ref()
T await() throws InterruptedException
InterruptedException
- if waiting is interruptedvoid executeWhenPresent(java.util.function.Predicate<T> run)
If the service has not yet been registered, this function is called from the thread the service is registered on after registration occurs. The return value of the function is ignored.
run
- The function to execute