This `synchronized` is always locking on the `TunableReplicatedReadableStore` instance. If you want to avoid that (and perhaps get better concurrency in the general case), you could use a pattern like this:

```scala
  val count = counts.get(result) match {
    case Some(existing) => 
      existing.incrementAndGet
    case None => 
      val newCounter = new AtomicInteger(0)
      counts.putIfAbsent(result, newCounter).getOrElse(newCounter)
  }
```