if (rtt > 0) avgRTT.add (rtt);
if (rtt >= 0) avgRTT.add (rtt);  if (loggingService.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append ("\n\nupdateRTT:"); buf.append ("\n  sendLink= " +sendLink); buf.append ("\n      node= " +node); buf.append ("\n  recvLink= " +receiveLink); buf.append ("\n       RTT= " +rtt+ " avg= " +avgRTT.getAverage()+ "\n"); loggingService.debug (buf.toString()); }
  private static void updateRTT (String sendLink, String node, String receiveLink, int rtt)  {    synchronized (roundtripTable)    {      String key = sendLink +"-"+ node;      Hashtable table = (Hashtable) roundtripTable.get (key);      if (table == null)      {        table = new Hashtable();        roundtripTable.put (key, table);      }      key = receiveLink;      RunningAverage avgRTT = (RunningAverage) table.get (key);      if (avgRTT == null)      {        //      samplePoolsize:  number of latest samples avg is calc from        //          startDelay:  throw away initial samples (which may be wildly off)        //  percentChangeLimit:  limit the amount the latest sample can change avg        //    changeLimitDelay:  how many samples before change limit kicks in        avgRTT = new RunningAverage (samplePoolsize, startDelay, percentChangeLimit, changeLimitDelay);        table.put (key, avgRTT);      }      if (rtt > 0) avgRTT.add (rtt);/*      System.err.println ("\nupdateRTT:"+                          "\n  sendLink= "+sendLink+                          "\n      node= "+node+                          "\n  recvLink= "+receiveLink+                          "\n       RTT= " +rtt+ " avg= " +avgRTT.getAverage()); */    }      }