Package io.grpc.internal
Class InUseStateAggregator<T>
java.lang.Object
io.grpc.internal.InUseStateAggregator<T>
Aggregates the in-use state of a set of objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
anyObjectInUse
(Object... objects) Returnstrue
if any of the given objects are in use.protected abstract void
Called when the aggregated in-use state has changed to true, which means at least one object is in use.protected abstract void
Called when the aggregated in-use state has changed to false, which means no object is in use.final boolean
isInUse()
final void
updateObjectInUse
(T object, boolean inUse) Update the in-use state of an object.
-
Constructor Details
-
InUseStateAggregator
public InUseStateAggregator()
-
-
Method Details
-
updateObjectInUse
Update the in-use state of an object. Initially no object is in use.This may call into
handleInUse()
orhandleNotInUse()
when appropriate. -
isInUse
public final boolean isInUse() -
anyObjectInUse
Returnstrue
if any of the given objects are in use.- Parameters:
objects
- The objects to consider.- Returns:
true
if any of the given objects are in use.
-
handleInUse
protected abstract void handleInUse()Called when the aggregated in-use state has changed to true, which means at least one object is in use. -
handleNotInUse
protected abstract void handleNotInUse()Called when the aggregated in-use state has changed to false, which means no object is in use.
-