if (initialNodeTime > 0) nodeTme.setAverage (initialNodeTime);  avgs = new Averages (commRTT, nodeTme); table.put (key, avgs);
commTable.put (key, commRTT);
  private void updateRTT (String sendLink, String node, String receiveLink, int rtt,                          long receiveTime, long nodeTime)  {    synchronized (roundtripTable)    {      String key = sendLink +"-"+ node;      Hashtable table = (Hashtable) roundtripTable.get (key);      if (table == null)      {        table = new Hashtable();        roundtripTable.put (key, table);      }      key = receiveLink;      Averages avgs = (Averages) table.get (key);      if (avgs == 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        RunningAverage commRTT = new RunningAverage (c_samplePoolsize, c_startDelay, c_percentChangeLimit, c_changeLimitDelay);        RunningAverage nodeTme = new RunningAverage (n_samplePoolsize, n_startDelay, n_percentChangeLimit, n_changeLimitDelay);        int initialCommRTT = getInitialCommRTT (sendLink, receiveLink);        if (initialCommRTT > 0)  commRTT.setAverage (initialCommRTT);        if (initialNodeTime > 0) nodeTme.setAverage (initialNodeTime);        avgs = new Averages (commRTT, nodeTme);        table.put (key, avgs);      }      if (rtt >= 0) avgs.commRTT.add (rtt);  // 0 RTTs are possible (ie. RTTs < 1 millisecond)      if (receiveTime > avgs.lastNodeTime)   // only the latest once (no virtuals skewing)      {        //  Only first-response-to-latest-send node times used; earlier receive times         //  and later send times are "virtual" in a way, and only suitable for calculating         //  comm RTTs (where node time is factored out).  Granted that the first message        //  to reach us may not be the first to leave the sending node, but that is ok, as        //  that is the real "response" time that we are looking for.        avgs.nodeTme.add (nodeTime);        avgs.lastNodeTime = receiveTime;        }      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);        int commLast = (int) avgs.commRTT.getLastSample();        int commAvg = (int) Math.rint (avgs.commRTT.getAverage());        int nodeLast = (int) avgs.nodeTme.getLastSample();        int nodeAvg = (int) Math.rint (avgs.nodeTme.getAverage());        String b11 = blank1 (commLast, nodeLast);  String b12 = blank1 (commAvg, nodeAvg);        String b21 = blank2 (commLast, nodeLast);  String b22 = blank2 (commAvg, nodeAvg);        buf.append ("\n   commRTT= " +b11+commLast+ " avg= " +b12+commAvg);        buf.append ("\n  nodeTime= " +b21+nodeLast+ " avg= " +b22+nodeAvg + "\n");//buf.append ("commRTT percent filled = " +avgs.commRTT.percentFilled() +"\n");        loggingService.debug (buf.toString());      }    }      }