Commit f6f735d8 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

Bucket#sample doesn't need to be synchronized

parent e7da0f34
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -11,13 +11,15 @@ case class MetricKey(key: String, mode: String, flush_interval: Long)

class Metric(key: MetricKey) {
  val bucket = BucketFactory.new_bucket(key.mode)
  var rbuf = new RingBuffer[(Long, Double)](10)
  var rbuf = new RingBuffer[(Long, Double)](1000)
  var rbuf_seek_pos = 0

  // adds a value to this metric
  def sample(value: Double) = this.synchronized {
  def sample(value: Double) = {
    this.synchronized {
      bucket.flush_every(key.flush_interval, (
        (time, value) => flush_bucket(time, value) ))
    }

    bucket.sample(value)
  }
+1 −1

File changed.

Contains only whitespace changes.