Skip to content

Commit 73459d2

Browse files
committed
refactor(search-index): replace ConcurrentCollectionFactory with ConcurrentHashMap.newKeySet #200
This change replaces the usage of `ConcurrentCollectionFactory` with `ConcurrentHashMap.newKeySet` for creating a concurrent set of unchecked IDs, simplifying the dependency and utilizing a more direct approach for concurrent set creation in `DiskSynchronizedEmbeddingSearchIndex`.
1 parent f147ca9 commit 73459d2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/kotlin/cc/unitmesh/devti/embedding/DiskSynchronizedEmbeddingSearchIndex.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
22
package cc.unitmesh.devti.embedding
33

4-
5-
import com.intellij.concurrency.ConcurrentCollectionFactory
64
import com.intellij.util.containers.CollectionFactory
75
import kotlinx.coroutines.coroutineScope
86
import kotlinx.coroutines.ensureActive
@@ -20,7 +18,8 @@ import kotlin.concurrent.write
2018
class DiskSynchronizedEmbeddingSearchIndex(val root: Path, limit: Int? = null) : EmbeddingSearchIndex {
2119
private var indexToId: MutableMap<Int, String> = CollectionFactory.createSmallMemoryFootprintMap()
2220
private var idToEntry: MutableMap<String, IndexEntry> = CollectionFactory.createSmallMemoryFootprintMap()
23-
private val uncheckedIds: MutableSet<String> = ConcurrentCollectionFactory.createConcurrentSet()
21+
private val uncheckedIds: MutableSet<String> = java.util.concurrent.ConcurrentHashMap.newKeySet()
22+
2423
var changed: Boolean = false
2524

2625
private val lock = ReentrantReadWriteLock()

0 commit comments

Comments
 (0)