Sitelet https://github.com/jasync-sql/jasync-sql/commit/970d606892aafeb4eaea00ebc0cd06e42e6e0e14
Skip to content

Commit 970d606

Browse files
authored
upgrade versions (#293)
KOTLIN_VERSION=1.6.21 KOTLIN_COROUTINES_VERSION=1.6.1 KOTLIN_LOGGING_VERSION=2.1.21 JACOCO=0.8.7 Minor fixes during migration.
1 parent e18556c commit 970d606

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- run: ./gradlew clean build --stacktrace
1818
- run: ./resources/detect-leak.sh mysql-async/target/mysql-async-tests.log
1919
- run: ./resources/detect-leak.sh postgresql-async/target/postgresql-async-tests.log
20-
- run: ./gradlew codeCoverageReport
20+
- run: ./gradlew codeCoverageReport --info --stacktrace
2121
# - ./gradlew build -Pnetty_version=4.0.56.Final
2222
# - ./gradlew clean build -x test
2323
# - ./gradlew :mysq-async:test --tests com.github.jasync.sql.db.mysql.QueryTimeoutSpec --info

‎gradle.properties‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
KOTLIN_VERSION=1.4.20
1+
KOTLIN_VERSION=1.6.21
22
BINTRAY_VERSION=1.8.3
33
ARTIFACTORY_VERSION=4.17.2
44
KTLINT_VERSION=9.2.1
5-
JACOCO_VERSION=0.8.3
6-
KOTLIN_COROUTINES_VERSION=1.4.2
5+
JACOCO_VERSION=0.8.7
6+
KOTLIN_COROUTINES_VERSION=1.6.1
77
SL4J_VERSION=1.7.25
88
JODA_VERSION=2.9.7
99
JODA_CONVERT_VERSION=1.8.1
1010
NETTY_VERSION=4.1.49.Final
11-
KOTLIN_LOGGING_VERSION=1.7.6
11+
KOTLIN_LOGGING_VERSION=2.1.21
1212
SCRAM_CLIENT_VERSION=2.1
1313
R2DBC_SPI_VERSION=0.8.0.RELEASE
1414
REACTOR_CORE_VERSION=3.2.6.RELEASE

‎mysql-async/src/main/java/com/github/jasync/sql/db/mysql/encoder/auth/OldPasswordAuthentication.kt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.github.jasync.sql.db.mysql.encoder.auth
22

33
import com.github.jasync.sql.db.util.length
44
import java.nio.charset.Charset
5+
import kotlin.math.floor
56

67
@Suppress("RedundantExplicitType", "UNUSED_VALUE", "VARIABLE_WITH_REDUNDANT_INITIALIZER")
78
object OldPasswordAuthentication : AuthenticationMethod {
@@ -33,15 +34,15 @@ object OldPasswordAuthentication : AuthenticationMethod {
3334
seed1 = ((seed1 * 3) + seed2) % max
3435
seed2 = (seed1 + seed2 + 33) % max
3536
d = seed1.toDouble() / max.toDouble()
36-
b = java.lang.Math.floor((d * 31) + 64).toByte()
37+
b = floor((d * 31) + 64).toInt().toByte()
3738
chars[i] = b.toChar()
3839
i += 1
3940
}
4041

4142
seed1 = ((seed1 * 3) + seed2) % max
4243
seed2 = (seed1 + seed2 + 33) % max
4344
d = seed1.toDouble() / max.toDouble()
44-
b = java.lang.Math.floor(d * 31).toByte()
45+
b = floor(d * 31).toInt().toByte()
4546

4647
var j = 0
4748
while (j < seed.length) {

‎pool-async/src/main/java/com/github/jasync/sql/db/pool/ActorBasedObjectPool.kt‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ internal constructor(
8585
throw PoolAlreadyTerminatedException()
8686
}
8787
val future = CompletableFuture<T>()
88-
val offered = actor.offer(Take(future))
88+
val offered = actor.trySend(Take(future)).isSuccess
8989
if (!offered) {
9090
future.completeExceptionally(Exception("could not offer to actor"))
9191
}
@@ -94,7 +94,7 @@ internal constructor(
9494

9595
override fun giveBack(item: T): CompletableFuture<AsyncObjectPool<T>> {
9696
val future = CompletableFuture<Unit>()
97-
val offered = actor.offer(GiveBack(item, future))
97+
val offered = actor.trySend(GiveBack(item, future)).isSuccess
9898
if (!offered) {
9999
future.completeExceptionally(Exception("could not offer to actor"))
100100
}
@@ -108,7 +108,7 @@ internal constructor(
108108
logger.info { "closing the pool" }
109109
closed = true
110110
val future = CompletableFuture<Unit>()
111-
val offered = actor.offer(Close(future))
111+
val offered = actor.trySend(Close(future)).isSuccess
112112
if (!offered) {
113113
future.completeExceptionally(Exception("could not offer to actor"))
114114
}
@@ -125,7 +125,7 @@ internal constructor(
125125
return
126126
}
127127
logger.trace { "testAvailableItems - starting" }
128-
val offered = actor.offer(TestPoolItems())
128+
val offered = actor.trySend(TestPoolItems()).isSuccess
129129
if (!offered) {
130130
logger.warn { "failed to offer to actor - testAvailableItems()" }
131131
}
@@ -381,7 +381,7 @@ private class ObjectPoolActor<T : PooledObject>(
381381
}
382382

383383
private fun offerOrLog(message: ActorObjectPoolMessage<T>, logMessage: () -> String) {
384-
val offered = channel.offer(message)
384+
val offered = channel.trySend(message).isSuccess
385385
if (!offered) {
386386
logger.warn { "failed to offer on ${logMessage()}" }
387387
}
@@ -537,8 +537,9 @@ private class ObjectPoolActor<T : PooledObject>(
537537
}
538538

539539
private fun validate(item: T) {
540-
when (val tried = objectFactory.validate(item)) {
541-
is Failure -> throw tried.exception
540+
val tried = objectFactory.validate(item)
541+
if (tried is Failure) {
542+
throw tried.exception
542543
}
543544
}
544545
}

0 commit comments

Comments
 (0)