aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt b/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt
index 6fb05024..ce6fbba0 100644
--- a/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt
+++ b/plugins/base/src/main/kotlin/resolvers/external/ExternalLocationProviderFactory.kt
@@ -1,6 +1,7 @@
package org.jetbrains.dokka.base.resolvers.external
import org.jetbrains.dokka.links.DRI
+import java.util.concurrent.ConcurrentHashMap
interface ExternalLocationProvider {
@@ -16,8 +17,8 @@ interface ExternalLocationProviderFactory {
class ExternalLocationProviderFactoryWithCache(val ext: ExternalLocationProviderFactory) : ExternalLocationProviderFactory {
- private val locationProviders: MutableList<ExternalLocationProvider> = mutableListOf()
+ private val locationProviders = ConcurrentHashMap<String, ExternalLocationProvider>()
override fun getExternalLocationProvider(param: String): ExternalLocationProvider? =
- locationProviders.find { it.param == param } ?: ext.getExternalLocationProvider(param)?.also { locationProviders.add(it) }
+ locationProviders.getOrPut(param) { ext.getExternalLocationProvider(param) }
} \ No newline at end of file