From 3fb22b30bb28e8316798db8a5a187265cb7200e4 Mon Sep 17 00:00:00 2001 From: tursom Date: Thu, 6 Jan 2022 15:29:32 +0800 Subject: [PATCH] update dependencies --- build.gradle.kts | 2 +- ts-core/build.gradle.kts | 6 ++--- ts-core/ts-async-http/build.gradle.kts | 6 ++--- ts-core/ts-buffer/build.gradle.kts | 2 +- ts-core/ts-coroutine/build.gradle.kts | 2 +- .../ts-coroutine-lock/build.gradle.kts | 2 +- ts-core/ts-curry/build.gradle.kts | 2 +- ts-core/ts-delegation/build.gradle.kts | 2 +- .../ObjectLockMutableDelegatedField.kt | 27 +++++++++++++++++++ .../cn/tursom/core/delegation/delegations.kt | 3 +++ ts-core/ts-json/build.gradle.kts | 6 ++--- ts-core/ts-log/build.gradle.kts | 6 ++--- ts-core/ts-ws-client/build.gradle.kts | 2 +- ts-database/build.gradle.kts | 4 +-- ts-database/ts-ktorm/build.gradle.kts | 2 +- ts-database/ts-mongodb/build.gradle.kts | 4 +-- .../operator/CachedInsertMongoOperator.kt | 3 ++- .../ts-mongodb-spring/build.gradle.kts | 2 +- ts-database/ts-mybatisplus/build.gradle.kts | 4 +-- ts-database/ts-redis/build.gradle.kts | 2 +- ts-socket/build.gradle.kts | 2 +- ts-web/ts-web-coroutine/build.gradle.kts | 2 +- ts-web/ts-web-netty/build.gradle.kts | 2 +- 23 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/ObjectLockMutableDelegatedField.kt diff --git a/build.gradle.kts b/build.gradle.kts index f53d41f..6ab7b10 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.6.0" + kotlin("jvm") version "1.6.10" `maven-publish` id("ts-gradle") } diff --git a/ts-core/build.gradle.kts b/ts-core/build.gradle.kts index 50a4979..4b6f30e 100644 --- a/ts-core/build.gradle.kts +++ b/ts-core/build.gradle.kts @@ -8,9 +8,9 @@ dependencies { api(kotlin("stdlib-jdk8")) api(kotlin("reflect")) api(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") - compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") - compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") - compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final") + compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.9") + compileOnly(group = "io.netty", name = "netty-all", version = "4.1.72.Final") testApi(group = "junit", name = "junit", version = "4.13.2") } diff --git a/ts-core/ts-async-http/build.gradle.kts b/ts-core/ts-async-http/build.gradle.kts index b325add..c018262 100644 --- a/ts-core/ts-async-http/build.gradle.kts +++ b/ts-core/ts-async-http/build.gradle.kts @@ -9,13 +9,13 @@ dependencies { api(project(":ts-core")) api(project(":ts-core:ts-buffer")) implementation(project(":ts-core:ts-xml")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") - compileOnly("com.squareup.okhttp3:okhttp:4.9.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + compileOnly("com.squareup.okhttp3:okhttp:4.9.3") //api(group = "com.squareup.retrofit2", name = "converter-gson", version = "2.9.0") //api(group = "com.squareup.retrofit2", name = "retrofit", version = "2.9.0") // https://mvnrepository.com/artifact/org.jsoup/jsoup - api(group = "org.jsoup", name = "jsoup", version = "1.14.2") + api(group = "org.jsoup", name = "jsoup", version = "1.14.3") testImplementation(project(":ts-core:ts-coroutine")) diff --git a/ts-core/ts-buffer/build.gradle.kts b/ts-core/ts-buffer/build.gradle.kts index 835693c..01262f2 100644 --- a/ts-core/ts-buffer/build.gradle.kts +++ b/ts-core/ts-buffer/build.gradle.kts @@ -7,7 +7,7 @@ plugins { dependencies { implementation(project(":ts-core:ts-log")) implementation(project(":ts-core")) - compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final") + compileOnly(group = "io.netty", name = "netty-all", version = "4.1.72.Final") } artifacts { diff --git a/ts-core/ts-coroutine/build.gradle.kts b/ts-core/ts-coroutine/build.gradle.kts index c5879da..773c51a 100644 --- a/ts-core/ts-coroutine/build.gradle.kts +++ b/ts-core/ts-coroutine/build.gradle.kts @@ -6,7 +6,7 @@ plugins { dependencies { implementation(project(":ts-core")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") } diff --git a/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts b/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts index c5879da..773c51a 100644 --- a/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts +++ b/ts-core/ts-coroutine/ts-coroutine-lock/build.gradle.kts @@ -6,7 +6,7 @@ plugins { dependencies { implementation(project(":ts-core")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") } diff --git a/ts-core/ts-curry/build.gradle.kts b/ts-core/ts-curry/build.gradle.kts index 50cbffc..fc151b0 100644 --- a/ts-core/ts-curry/build.gradle.kts +++ b/ts-core/ts-curry/build.gradle.kts @@ -7,7 +7,7 @@ plugins { dependencies { implementation(project(":")) implementation(project(":ts-core")) - testImplementation(group = "junit", name = "junit", version = "4.13") + testImplementation(group = "junit", name = "junit", version = "4.13.2") } diff --git a/ts-core/ts-delegation/build.gradle.kts b/ts-core/ts-delegation/build.gradle.kts index 159ade0..80f11c3 100644 --- a/ts-core/ts-delegation/build.gradle.kts +++ b/ts-core/ts-delegation/build.gradle.kts @@ -6,7 +6,7 @@ plugins { dependencies { api(project(":ts-core")) - compileOnly(group = "io.netty", name = "netty-all", version = "4.1.67.Final") + compileOnly(group = "io.netty", name = "netty-all", version = "4.1.72.Final") } diff --git a/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/ObjectLockMutableDelegatedField.kt b/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/ObjectLockMutableDelegatedField.kt new file mode 100644 index 0000000..904d818 --- /dev/null +++ b/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/ObjectLockMutableDelegatedField.kt @@ -0,0 +1,27 @@ +package cn.tursom.core.delegation + +import java.util.concurrent.locks.Lock +import java.util.concurrent.locks.ReentrantLock +import kotlin.reflect.KProperty + +class ObjectLockMutableDelegatedField( + override val delegatedField: MutableDelegatedField, + private val lock: Any, +) : MutableDelegatedField by delegatedField, DecoratorMutableDelegatedField { + constructor( + initValue: V, + lock: Lock = ReentrantLock(), + ) : this(MutableDelegatedFieldValue(initValue), lock) + + override fun getValue(thisRef: T, property: KProperty<*>): V = synchronized(lock) { + delegatedField.getValue(thisRef, property) + } + + override fun setValue(thisRef: T, property: KProperty<*>, value: V) = synchronized(lock) { + delegatedField.setValue(thisRef, property, value) + } + + override fun valueOnSet(thisRef: T, property: KProperty<*>, value: V, oldValue: V) = synchronized(lock) { + delegatedField.valueOnSet(thisRef, property, value, oldValue) + } +} \ No newline at end of file diff --git a/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/delegations.kt b/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/delegations.kt index bdb2001..8b7bace 100644 --- a/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/delegations.kt +++ b/ts-core/ts-delegation/src/main/kotlin/cn/tursom/core/delegation/delegations.kt @@ -77,6 +77,9 @@ fun DelegatedField.notNull(ifNull: () -> Nothing): Delegated fun MutableDelegatedField.notNull(ifNull: () -> Nothing): MutableDelegatedField = NotNullMutableDelegatedField(uncheckedCast(), ifNull) +fun MutableDelegatedField.objectLocked(lock: Any): MutableDelegatedField = + ObjectLockMutableDelegatedField(this, lock) + val MutableDelegatedField.locked: MutableDelegatedField get() = LockMutableDelegatedField(this) fun MutableDelegatedField.locked(lock: Lock = ReentrantLock()): MutableDelegatedField = LockMutableDelegatedField(this, lock) diff --git a/ts-core/ts-json/build.gradle.kts b/ts-core/ts-json/build.gradle.kts index 9129ac7..fec9bb0 100644 --- a/ts-core/ts-json/build.gradle.kts +++ b/ts-core/ts-json/build.gradle.kts @@ -6,9 +6,9 @@ plugins { dependencies { implementation(project(":")) - compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") - compileOnly(group = "com.fasterxml.jackson.core", name = "jackson-core", version = "2.12.4") - compileOnly(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.12.4") + compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.9") + compileOnly(group = "com.fasterxml.jackson.core", name = "jackson-core", version = "2.13.1") + compileOnly(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.13.1") } diff --git a/ts-core/ts-log/build.gradle.kts b/ts-core/ts-log/build.gradle.kts index 6de7707..d3fe14f 100644 --- a/ts-core/ts-log/build.gradle.kts +++ b/ts-core/ts-log/build.gradle.kts @@ -8,10 +8,10 @@ dependencies { implementation(project(":ts-core")) implementation(project(":ts-core:ts-delegation")) api(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") - api(group = "ch.qos.logback", name = "logback-core", version = "1.2.5") - api(group = "ch.qos.logback", name = "logback-classic", version = "1.2.5") + api(group = "ch.qos.logback", name = "logback-core", version = "1.2.10") + api(group = "ch.qos.logback", name = "logback-classic", version = "1.2.10") - compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") + compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.9") } diff --git a/ts-core/ts-ws-client/build.gradle.kts b/ts-core/ts-ws-client/build.gradle.kts index 525eced..48c3f73 100644 --- a/ts-core/ts-ws-client/build.gradle.kts +++ b/ts-core/ts-ws-client/build.gradle.kts @@ -9,7 +9,7 @@ dependencies { api(project(":ts-core:ts-buffer")) api(project(":ts-core:ts-log")) compileOnly(project(":ts-socket")) - api(group = "io.netty", name = "netty-all", version = nettyVersion) + api(group = "io.netty", name = "netty-all", version = "4.1.72.Final") } diff --git a/ts-database/build.gradle.kts b/ts-database/build.gradle.kts index 53d0ff8..c1fe9fc 100644 --- a/ts-database/build.gradle.kts +++ b/ts-database/build.gradle.kts @@ -12,8 +12,8 @@ dependencies { implementation(project(":ts-core:ts-clone")) implementation(project(":ts-core:ts-log")) api(group = "org.ktorm", name = "ktorm-core", version = "3.4.1") - compileOnly(group = "com.baomidou", name = "mybatis-plus", version = "3.4.3.1") - compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") + compileOnly(group = "com.baomidou", name = "mybatis-plus", version = "3.4.3.4") + compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.9") testApi(group = "junit", name = "junit", version = "4.13.2") } diff --git a/ts-database/ts-ktorm/build.gradle.kts b/ts-database/ts-ktorm/build.gradle.kts index f2a8022..2d1d978 100644 --- a/ts-database/ts-ktorm/build.gradle.kts +++ b/ts-database/ts-ktorm/build.gradle.kts @@ -12,7 +12,7 @@ dependencies { implementation(project(":ts-core:ts-clone")) implementation(project(":ts-core:ts-log")) api(group = "org.ktorm", name = "ktorm-core", version = "3.4.1") - compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") + compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.9") testApi(group = "junit", name = "junit", version = "4.13.2") } diff --git a/ts-database/ts-mongodb/build.gradle.kts b/ts-database/ts-mongodb/build.gradle.kts index 5e29f5a..4ad8ea3 100644 --- a/ts-database/ts-mongodb/build.gradle.kts +++ b/ts-database/ts-mongodb/build.gradle.kts @@ -9,8 +9,8 @@ dependencies { implementation(project(":ts-core")) implementation(project(":ts-core:ts-datastruct")) implementation(project(":ts-core:ts-log")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") - api(group = "org.mongodb", name = "mongodb-driver-reactivestreams", version = "4.3.0") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + api(group = "org.mongodb", name = "mongodb-driver-reactivestreams", version = "4.4.0") } diff --git a/ts-database/ts-mongodb/src/main/kotlin/cn/tursom/database/mongodb/operator/CachedInsertMongoOperator.kt b/ts-database/ts-mongodb/src/main/kotlin/cn/tursom/database/mongodb/operator/CachedInsertMongoOperator.kt index 385ebea..0cf1f6c 100644 --- a/ts-database/ts-mongodb/src/main/kotlin/cn/tursom/database/mongodb/operator/CachedInsertMongoOperator.kt +++ b/ts-database/ts-mongodb/src/main/kotlin/cn/tursom/database/mongodb/operator/CachedInsertMongoOperator.kt @@ -59,7 +59,8 @@ class CachedInsertMongoOperator( @Suppress("EXPERIMENTAL_API_USAGE") while (!documentChannel.isClosedForReceive) { try { - list.add(documentChannel.poll() ?: withTimeout(maxDelayTimeMS) { documentChannel.receive() }) + list.add( + documentChannel.tryReceive().getOrNull() ?: withTimeout(maxDelayTimeMS) { documentChannel.receive() }) received.incrementAndGet() } catch (e: TimeoutCancellationException) { } catch (e: ClosedReceiveChannelException) { diff --git a/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts b/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts index bcaef58..015325e 100644 --- a/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts +++ b/ts-database/ts-mongodb/ts-mongodb-spring/build.gradle.kts @@ -7,7 +7,7 @@ plugins { dependencies { api(project(":")) implementation(project(":ts-core")) - compileOnly(group = "org.springframework.data", name = "spring-data-mongodb", version = "3.2.4") + compileOnly(group = "org.springframework.data", name = "spring-data-mongodb", version = "3.3.0") } diff --git a/ts-database/ts-mybatisplus/build.gradle.kts b/ts-database/ts-mybatisplus/build.gradle.kts index 78df7a5..54cb772 100644 --- a/ts-database/ts-mybatisplus/build.gradle.kts +++ b/ts-database/ts-mybatisplus/build.gradle.kts @@ -11,8 +11,8 @@ dependencies { implementation(project(":ts-core")) implementation(project(":ts-core:ts-clone")) implementation(project(":ts-core:ts-log")) - implementation(group = "com.baomidou", name = "mybatis-plus", version = "3.4.3.2") - compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.7") + implementation(group = "com.baomidou", name = "mybatis-plus", version = "3.4.3.4") + compileOnly(group = "com.google.code.gson", name = "gson", version = "2.8.9") testApi(group = "junit", name = "junit", version = "4.13.2") } diff --git a/ts-database/ts-redis/build.gradle.kts b/ts-database/ts-redis/build.gradle.kts index 5610d0b..06362ff 100644 --- a/ts-database/ts-redis/build.gradle.kts +++ b/ts-database/ts-redis/build.gradle.kts @@ -8,7 +8,7 @@ dependencies { api(project(":")) implementation(project(":ts-core")) implementation(project(":ts-core:ts-log")) - api(group = "redis.clients", name = "jedis", version = "3.6.3") + api(group = "redis.clients", name = "jedis", version = "3.3.0") } diff --git a/ts-socket/build.gradle.kts b/ts-socket/build.gradle.kts index 45c9a4f..f751067 100644 --- a/ts-socket/build.gradle.kts +++ b/ts-socket/build.gradle.kts @@ -10,7 +10,7 @@ dependencies { implementation(project(":ts-core:ts-buffer")) implementation(project(":ts-core:ts-pool")) implementation(project(":ts-core:ts-log")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") } diff --git a/ts-web/ts-web-coroutine/build.gradle.kts b/ts-web/ts-web-coroutine/build.gradle.kts index 1e9512e..09796ec 100644 --- a/ts-web/ts-web-coroutine/build.gradle.kts +++ b/ts-web/ts-web-coroutine/build.gradle.kts @@ -11,7 +11,7 @@ dependencies { implementation(project(":ts-core:ts-buffer")) implementation(project(":ts-core:ts-json")) implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") } diff --git a/ts-web/ts-web-netty/build.gradle.kts b/ts-web/ts-web-netty/build.gradle.kts index b8eab20..8c6d316 100644 --- a/ts-web/ts-web-netty/build.gradle.kts +++ b/ts-web/ts-web-netty/build.gradle.kts @@ -9,7 +9,7 @@ dependencies { api(project(":ts-core:ts-buffer")) api(project(":ts-core:ts-log")) api(project(":ts-web")) - api(group = "io.netty", name = "netty-all", version = nettyVersion) + api(group = "io.netty", name = "netty-all", version = "4.1.72.Final") api(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") }