From 25b8a025fd929eeed9e7bdc4cb2b9dd181c7895f Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 19 Aug 2024 22:34:30 +0200 Subject: [PATCH] Replaced stately-concurrency with atomicfu --- fints4k/build.gradle | 8 ++++---- .../kotlin/net/dankito/banking/fints/model/JobContext.kt | 4 ++-- gradle.properties | 1 + settings.gradle.kts | 6 ++++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fints4k/build.gradle b/fints4k/build.gradle index cf486f58..e685b60d 100644 --- a/fints4k/build.gradle +++ b/fints4k/build.gradle @@ -1,6 +1,8 @@ plugins { - id "org.jetbrains.kotlin.multiplatform" - id "org.jetbrains.kotlin.plugin.serialization" version "$kotlinVersion" + id("org.jetbrains.kotlin.multiplatform") + id("org.jetbrains.kotlin.plugin.serialization") version "$kotlinVersion" + id("org.jetbrains.kotlinx.atomicfu") + id "maven-publish" } @@ -69,8 +71,6 @@ kotlin { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") - implementation "co.touchlab:stately-concurrency:1.2.0" - implementation("io.ktor:ktor-client-core:$ktorVersion") } } diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/JobContext.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/JobContext.kt index 87fc2302..3073d9f9 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/JobContext.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/JobContext.kt @@ -1,6 +1,6 @@ package net.dankito.banking.fints.model -import co.touchlab.stately.concurrency.AtomicInt +import kotlinx.atomicfu.atomic import net.dankito.banking.fints.callback.FinTsClientCallback import net.dankito.banking.fints.log.IMessageLogAppender import net.dankito.banking.fints.log.MessageContext @@ -27,7 +27,7 @@ open class JobContext( ) : MessageBaseData(bank, product), IMessageLogAppender { companion object { - private var JobCount = AtomicInt(0) // this variable is accessed from multiple threads, so make it thread safe + private val JobCount = atomic(0) // this variable is accessed from multiple threads, so make it thread safe } diff --git a/gradle.properties b/gradle.properties index 76c7601b..0806cad3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,7 @@ ktorVersion=2.3.12 kotlinxDateTimeVersion=0.6.0 # kotlinx-serialization 1.7.x requires Kotlin 2.0 kotlinxSerializationVersion=1.6.3 +atomicfuVersion=0.25.0 klfVersion=1.5.1 diff --git a/settings.gradle.kts b/settings.gradle.kts index 761600ee..3089a221 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,8 +1,14 @@ pluginManagement { + val atomicfuVersion: String by settings + repositories { mavenCentral() gradlePluginPortal() } + + plugins { + id("org.jetbrains.kotlinx.atomicfu") version atomicfuVersion + } } rootProject.name = "fints4kProject"