diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-01-31 18:38:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 18:38:09 +0100 |
commit | fe360f7fadc7173be3ae170778a93ebd01962149 (patch) | |
tree | 25ea1be7e75ffd3c3235cd8ab4109bb26c5b2ad0 /runners | |
parent | eb54d69a5cd8e27b1235a23b9098e285c408cb23 (diff) | |
download | dokka-fe360f7fadc7173be3ae170778a93ebd01962149.tar.gz dokka-fe360f7fadc7173be3ae170778a93ebd01962149.tar.bz2 dokka-fe360f7fadc7173be3ae170778a93ebd01962149.zip |
Make implementations of DokkaLogger thread-safe (#2827)
Diffstat (limited to 'runners')
-rw-r--r-- | runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt index 4b5f4fa9..ac8ed376 100644 --- a/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt +++ b/runners/maven-plugin/src/main/kotlin/MavenDokkaLogger.kt @@ -2,14 +2,23 @@ package org.jetbrains.dokka.maven import org.apache.maven.plugin.logging.Log import org.jetbrains.dokka.utilities.DokkaLogger +import java.util.concurrent.atomic.AtomicInteger class MavenDokkaLogger(val log: Log) : DokkaLogger { - override var warningsCount: Int = 0 - override var errorsCount: Int = 0 + private val warningsCounter = AtomicInteger() + private val errorsCounter = AtomicInteger() + + override var warningsCount: Int + get() = warningsCounter.get() + set(value) = warningsCounter.set(value) + + override var errorsCount: Int + get() = errorsCounter.get() + set(value) = errorsCounter.set(value) override fun debug(message: String) = log.debug(message) override fun info(message: String) = log.info(message) override fun progress(message: String) = log.info(message) - override fun warn(message: String) = log.warn(message).also { warningsCount++ } - override fun error(message: String) = log.error(message).also { errorsCount++ } + override fun warn(message: String) = log.warn(message).also { warningsCounter.incrementAndGet() } + override fun error(message: String) = log.error(message).also { errorsCounter.incrementAndGet() } } |