Class ConcurrentChildScopes
java.lang.Object
io.github.cowwoc.pouch10.core.ConcurrentChildScopes
Manages child scopes.
This class is thread-safe.
Preconditions that apply to all methods:
- Parent scope is not closed.
- Child scope implementations of
close()are idempotent.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ConcurrentChildScopes
public ConcurrentChildScopes()Creates a new ConcurrentChildScopes.
-
-
Method Details
-
add
Adds a child scope.- Parameters:
child- the child scope- Throws:
NullPointerException- ifchildis nullIllegalArgumentException- ifchildwas already added to this scopeIllegalStateException- if shutdown has been requested
-
remove
Removes a child scope.- Parameters:
child- the child scope- Returns:
trueon success;falseif the scope was not found- Throws:
NullPointerException- ifchildis null
-
shutdown
Initiates a graceful shutdown of child scopes.- Parameters:
timeout- the amount of time to wait for the children to shut down on their own before invokingclose()on them- Returns:
trueif all the children shut down gracefully,falseif a shutdown is already in progress or a timeout occurred- Throws:
WrappedCheckedException- if the thread is interrupted or a child scope threw an exception while shutting down
-