Skip to content

Commit

Permalink
use ConcurrentHashMap to parallelize invocations with different tool …
Browse files Browse the repository at this point in the history
…classpaths
  • Loading branch information
bjaglin committed Apr 17, 2024
1 parent 2870da0 commit 6d8e50f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/scala/scalafix/internal/sbt/BlockingCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import scala.util.Try
/** A basic thread-safe cache without any eviction. */
class BlockingCache[K, V] {

// Number of keys is expected to be very small so the global lock should not be a bottleneck
private val underlying = ju.Collections.synchronizedMap(new ju.HashMap[K, V])
private val underlying = new ju.concurrent.ConcurrentHashMap[K, V]

// Evaluations of `transform` are guaranteed to be sequential for the same key
def compute(key: K, transform: Option[V] => Option[V]): V = {
Expand Down

0 comments on commit 6d8e50f

Please sign in to comment.