Interface Drainable

All Known Subinterfaces:
ForcedDrainable

public interface Drainable
Indicates connection pools and similar data structures have a means of waiting for resources to close/clean up. The drain method may be used to block while all resources are closed or cleaned up in some implementation-specific way.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    drain(long timeout, TimeUnit unit)
    Waits for all resources to become free.
  • Method Details

    • drain

      boolean drain(long timeout, @Nonnull TimeUnit unit)
      Waits for all resources to become free. For pooling resources, draining ensures all pooled resources have been returned to the pool.
      Parameters:
      timeout - the timeout which, using the specified unit, will be converted to milliseconds
      unit - the unit the provided timeout is in
      Returns:
      true if the pool was drained; otherwise, false if 1 or more resources could not be accounted for within the specified timeout