com.zaxxer.hikari检测到线程饥饿或时钟跳动

时间:2019-04-26 08:02:15

标签: gradle hikaricp

在我的Kotlin项目中

build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile(
            "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
            , "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+"
            , "ch.qos.logback:logback-classic:1.2.3"
            , "com.zaxxer:HikariCP:3.1.0"
            , 'org.postgresql:postgresql:42.2.2'
            , "com.squareup.okhttp3:okhttp:3.12.1"
            , "org.apache.commons:commons-compress:1.18"
            , 'com.google.code.gson:gson:2.8.5'
    )

    testCompile group: 'junit', name: 'junit', version: '4.11'
}

在我的Kotlin代码中:

import com.google.gson.JsonElement
import com.google.gson.JsonParser
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import okhttp3.*
import okio.ByteString

lateinit var ds: HikariDataSource

val dbConfig = HikariConfig("hikari.conf")
ds = HikariDataSource(dbConfig)

 val insertQuery = createInsertQuery(responseJsonElement);
            if (!insertQuery.isEmpty()) {
                val connection = ds.connection
                val insert = connection.prepareCall(insertQuery)
                insert.execute()
                insert.close()
                connection.close()
            }
        }

com.zaxxer.hikari工作成功。

但是有时在debug.log中,我会收到下一个警告

2019-04-26 00:00:08,899 18780794 [HikariPool-1 housekeeper] WARN  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=1m29s94ms58µs).

2019-04-26 00:00:08,902 18780797 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=3, active=0, idle=3, waiting=0)

2019-04-26 00:00:38,905 18810800 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=3, active=0, idle=3, waiting=0)

这正常吗?

0 个答案:

没有答案