Package org.jgrapes.core.internal
Class GeneratorRegistry
java.lang.Object
org.jgrapes.core.internal.GeneratorRegistry
A registry for generators.
Used to track generators and determine whether the application has stopped.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a generator.void
Await exhaustion.boolean
awaitExhaustion
(long timeout) Await exhaustion with a timeout.static GeneratorRegistry
instance()
Returns the singleton instance of the registry.boolean
Checks if is exhausted (no generators left)void
Removes the generator.
-
Method Details
-
instance
Returns the singleton instance of the registry.- Returns:
- the generator registry
-
add
Adds a generator.- Parameters:
obj
- the obj
-
remove
Removes the generator.- Parameters:
obj
- the generator
-
isExhausted
Checks if is exhausted (no generators left)- Returns:
- true, if is exhausted
-
awaitExhaustion
Await exhaustion.- Throws:
InterruptedException
- the interrupted exception
-
awaitExhaustion
Await exhaustion with a timeout.- Parameters:
timeout
- the timeout- Returns:
- true, if successful
- Throws:
InterruptedException
- the interrupted exception
-