code: private int drainToSize(int minPooled, int maxDiscard)
      {
          // Stop draining if we have reached the maximum drain amount.
          // This slows the drain process, allowing for the pool to become
          // active before becoming fully drained (to minimum level).
          int numDiscarded = 0;
          Object o = null;
  
          while (numDiscarded < maxDiscard) {
              o = buffer.popWithLimit(minPooled);
  
              if (o != null) {
                  ++numDiscarded;
                  if (discardStrategy != null) {
                      discardStrategy.discard(o);
                  }
              } else
                  break;
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
              Tr.debug(tc, "drainToSize: numDiscarded=" + numDiscarded + ", inactive=" + ivInactiveNoDrainCount + ", " + this);
  
          if (beanPerf != null) { // Update PMI data
              beanPerf.poolDrained(buffer.size(), numDiscarded);
          }
          return numDiscarded;
      }
docs: F96377