private ClientSocket openRecycle(){
  long now=CurrentTime.currentTime();
  ClientSocket stream=null;
synchronized (this) {
    if (_idleHead != _idleTail) {
      stream=_idle[_idleHead];
      long freeTime=stream.getIdleStartTime();
      _idle[_idleHead]=null;
      _idleHead=(_idleHead + _idle.length - 1) % _idle.length;
      if (now < freeTime + _loadBalanceIdleTime) {
        _activeCount.incrementAndGet();
        _keepaliveCountTotal++;
        stream.clearIdleStartTime();
        stream.toActive();
        return stream;
      }
    }
  }
  if (stream != null) {
    if (log.isLoggable(Level.FINER))     log.finer(this + " close idle " + stream+ " expire="+ QDate.formatISO8601(stream.getIdleStartTime() + _loadBalanceIdleTime));
    stream.closeImpl();
  }
  return null;
}

private ClientSocket openRecycle ( ) { long now = CurrentTime . currentTime ( ) ; ClientSocket stream = null ; synchronized ( this ) { if ( _idleHead != _idleTail ) { stream = _idle [ _idleHead ] ; long freeTime = stream . getIdleStartTime ( ) ; _idle [ _idleHead ] = null ; _idleHead = ( _idleHead + _idle . length - 1 ) % _idle . length ; if ( now < freeTime + _loadBalanceIdleTime ) { _activeCount . incrementAndGet ( ) ; _keepaliveCountTotal ++ ; stream . clearIdleStartTime ( ) ; stream . toActive ( ) ; return stream ; } } } if ( stream != null ) { if ( log . isLoggable ( Level . FINER ) ) log . finer ( this + " close idle " + stream + " expire=" + QDate . formatISO8601 ( stream . getIdleStartTime ( ) + _loadBalanceIdleTime ) ) ; stream . closeImpl ( ) ; } return null ; }
returns a valid recycled stream from the idle pool to the backend . if the stream has been in the pool for too long ( > live_time ) , close it instead .
