Sitelet https://github.com/jasync-sql/jasync-sql/pull/293/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- run: ./gradlew clean build --stacktrace
- run: ./resources/detect-leak.sh mysql-async/target/mysql-async-tests.log
- run: ./resources/detect-leak.sh postgresql-async/target/postgresql-async-tests.log
- run: ./gradlew codeCoverageReport
- run: ./gradlew codeCoverageReport --info --stacktrace
# - ./gradlew build -Pnetty_version=4.0.56.Final
# - ./gradlew clean build -x test
# - ./gradlew :mysq-async:test --tests com.github.jasync.sql.db.mysql.QueryTimeoutSpec --info
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
KOTLIN_VERSION=1.4.20
KOTLIN_VERSION=1.6.21
BINTRAY_VERSION=1.8.3
ARTIFACTORY_VERSION=4.17.2
KTLINT_VERSION=9.2.1
JACOCO_VERSION=0.8.3
KOTLIN_COROUTINES_VERSION=1.4.2
JACOCO_VERSION=0.8.7
KOTLIN_COROUTINES_VERSION=1.6.1
SL4J_VERSION=1.7.25
JODA_VERSION=2.9.7
JODA_CONVERT_VERSION=1.8.1
NETTY_VERSION=4.1.49.Final
KOTLIN_LOGGING_VERSION=1.7.6
KOTLIN_LOGGING_VERSION=2.1.21
SCRAM_CLIENT_VERSION=2.1
R2DBC_SPI_VERSION=0.8.0.RELEASE
REACTOR_CORE_VERSION=3.2.6.RELEASE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.jasync.sql.db.mysql.encoder.auth

import com.github.jasync.sql.db.util.length
import java.nio.charset.Charset
import kotlin.math.floor

@Suppress("RedundantExplicitType", "UNUSED_VALUE", "VARIABLE_WITH_REDUNDANT_INITIALIZER")
object OldPasswordAuthentication : AuthenticationMethod {
Expand Down Expand Up @@ -33,15 +34,15 @@ object OldPasswordAuthentication : AuthenticationMethod {
seed1 = ((seed1 * 3) + seed2) % max
seed2 = (seed1 + seed2 + 33) % max
d = seed1.toDouble() / max.toDouble()
b = java.lang.Math.floor((d * 31) + 64).toByte()
b = floor((d * 31) + 64).toInt().toByte()
chars[i] = b.toChar()
i += 1
}

seed1 = ((seed1 * 3) + seed2) % max
seed2 = (seed1 + seed2 + 33) % max
d = seed1.toDouble() / max.toDouble()
b = java.lang.Math.floor(d * 31).toByte()
b = floor(d * 31).toInt().toByte()

var j = 0
while (j < seed.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal constructor(
throw PoolAlreadyTerminatedException()
}
val future = CompletableFuture<T>()
val offered = actor.offer(Take(future))
val offered = actor.trySend(Take(future)).isSuccess
if (!offered) {
future.completeExceptionally(Exception("could not offer to actor"))
}
Expand All @@ -94,7 +94,7 @@ internal constructor(

override fun giveBack(item: T): CompletableFuture<AsyncObjectPool<T>> {
val future = CompletableFuture<Unit>()
val offered = actor.offer(GiveBack(item, future))
val offered = actor.trySend(GiveBack(item, future)).isSuccess
if (!offered) {
future.completeExceptionally(Exception("could not offer to actor"))
}
Expand All @@ -108,7 +108,7 @@ internal constructor(
logger.info { "closing the pool" }
closed = true
val future = CompletableFuture<Unit>()
val offered = actor.offer(Close(future))
val offered = actor.trySend(Close(future)).isSuccess
if (!offered) {
future.completeExceptionally(Exception("could not offer to actor"))
}
Expand All @@ -125,7 +125,7 @@ internal constructor(
return
}
logger.trace { "testAvailableItems - starting" }
val offered = actor.offer(TestPoolItems())
val offered = actor.trySend(TestPoolItems()).isSuccess
if (!offered) {
logger.warn { "failed to offer to actor - testAvailableItems()" }
}
Expand Down Expand Up @@ -381,7 +381,7 @@ private class ObjectPoolActor<T : PooledObject>(
}

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

private fun validate(item: T) {
when (val tried = objectFactory.validate(item)) {
is Failure -> throw tried.exception
val tried = objectFactory.validate(item)
if (tried is Failure) {
throw tried.exception
}
}
}
Expand Down