Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-539

Statistics variable atomicity in RequestHandlerBase

    Details

      Description

      Writes are not atomic on longs unless they are volatile. At a minimum, numRequests, numErrors, and totalTime should be marked volatile. More correct, but higher overhead due to contention and synchronization would be to use AtomicLong.

      There is a minor error in the calculation of avgRequestsPerSecond. The first operand of the denominator is cast to a float then has a long subtracted from it, in effect casting both longs to floats then performing the subtraction. It is better to do the subtraction as longs then cast to a float.

        Attachments

          Activity

            People

            • Assignee:
              otis Otis Gospodnetic
              Reporter:
              timmsc Sean Timm
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: