private synchronized void refreshSockets(){
  refreshAperture();
  int n=pendingSockets + activeSockets.size();
  if (n < targetAperture && !activeFactories.isEmpty()) {
    logger.debug("aperture {} is below target {}, adding {} sockets",n,targetAperture,targetAperture - n);
    addSockets(targetAperture - n);
  }
 else   if (targetAperture < activeSockets.size()) {
    logger.debug("aperture {} is above target {}, quicking 1 socket",n,targetAperture);
    quickSlowestRS();
  }
  long now=Clock.now();
  if (now - lastRefresh < refreshPeriod) {
    return;
  }
 else {
    long prev=refreshPeriod;
    refreshPeriod=(long)Math.min(refreshPeriod * 1.5,maxRefreshPeriod);
    logger.info("Bumping refresh period, {}->{}",prev / 1000,refreshPeriod / 1000);
  }
  lastRefresh=now;
  addSockets(1);
}

private synchronized void refreshSockets ( ) { refreshAperture ( ) ; int n = pendingSockets + activeSockets . size ( ) ; if ( n < targetAperture && ! activeFactories . isEmpty ( ) ) { logger . debug ( "aperture {} is below target {}, adding {} sockets" , n , targetAperture , targetAperture - n ) ; addSockets ( targetAperture - n ) ; } else if ( targetAperture < activeSockets . size ( ) ) { logger . debug ( "aperture {} is above target {}, quicking 1 socket" , n , targetAperture ) ; quickSlowestRS ( ) ; } long now = Clock . now ( ) ; if ( now - lastRefresh < refreshPeriod ) { return ; } else { long prev = refreshPeriod ; refreshPeriod = ( long ) Math . min ( refreshPeriod * 1.5 , maxRefreshPeriod ) ; logger . info ( "Bumping refresh period, {}->{}" , prev / 1000 , refreshPeriod / 1000 ) ; } lastRefresh = now ; addSockets ( 1 ) ; }
responsible for : - refreshing the aperture - asynchronously adding / removing reactive sockets to match targetaperture - periodically add a new connection
