public synchronized void release ( T poolObject ) { if ( closed ) return ; // Someone's waiting ? if ( pendingWaits > 0 ) { available . add ( poolObject ) ; notifyAll ( ) ; } else { // Pool is too large, destroy object if ( available . size ( ) >= maxIdle ) { all . remove ( poolObject ) ; internalDestroyPoolObject ( poolObject ) ; } else available . add ( poolObject ) ; // Recycle object } }
Return an object to the pool