code: final public void add(long curTime, long val) {
          if (!enabled)
              return;
  
          lastSampleTime = curTime;
          if (!sync) {
              if (val > max)
                  max = val;
  
              if (count > 0) {
                  if (val < min)
                      min = val;
              } else
                  min = val; //set min=val for the first time
  
              /*
               * if (val < min || min < 0)
               * min = val;
               */
              count++;
              total += val;
              sumOfSquares += val * val;
          } else {
              // synchronized ONLY the count updates
              synchronized (this) {
                  count++;
                  total += val;
              }
  
              if (val > max)
                  max = val;
  
              if (count > 0) {
                  if (val < min)
                      min = val;
              } else
                  min = val; //set min=val for the first time
  
              sumOfSquares += val * val;
          }
      }
docs: /*
  Synchronizable: counter is "updated" with the input value