Class InUseStateAggregator<T>

java.lang.Object
io.grpc.internal.InUseStateAggregator<T>

@NotThreadSafe public abstract class InUseStateAggregator<T> extends Object
Aggregates the in-use state of a set of objects.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    anyObjectInUse(Object... objects)
    Returns true 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
     
    final void
    updateObjectInUse(T object, boolean inUse)
    Update the in-use state of an object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InUseStateAggregator

      public InUseStateAggregator()
  • Method Details

    • updateObjectInUse

      public final void updateObjectInUse(T object, boolean inUse)
      Update the in-use state of an object. Initially no object is in use.

      This may call into handleInUse() or handleNotInUse() when appropriate.

    • isInUse

      public final boolean isInUse()
    • anyObjectInUse

      public final boolean anyObjectInUse(Object... objects)
      Returns true 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.