--- title: "JDK不支持线程等待阻塞时间统计 - 如何解决此Elasticsearch异常" date: 2026-02-27 lastmod: 2026-02-27 description: "Elasticsearch在不支持线程等待/阻塞时间统计的JDK版本上运行时出现的错误及解决方案" tags: ["JDK", "线程监控", "异常处理", "配置问题"] summary: "版本: 7.16-8.9 简而言之,当Elasticsearch运行在不支持线程等待/阻塞时间统计的Java开发工具包(JDK)版本上时,就会出现此错误。Elasticsearch使用此功能来监控和管理线程使用情况。要解决此问题,您可以升级到支持此功能的JDK版本,或者在Elasticsearch设置中禁用线程等待/阻塞时间统计。或者,您可以切换到支持此功能的其他JDK发行版。 日志上下文 # 日志"thread wait/blocked time accounting is not supported on this JDK"的类名是 HotThreads.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解的人参考: } // Enabling thread contention monitoring is required for capturing JVM thread wait/blocked times. If we weren't // able to enable this functionality during bootstrap; we should not produce HotThreads reports. if (isThreadWaitBlockTimeMonitoringEnabled(threadBean) == false) { throw new ElasticsearchException("thread wait/blocked time accounting is not supported on this JDK"); } StringBuilder sb = new StringBuilder()." --- > **版本:** 7.16-8.9 简而言之,当Elasticsearch运行在不支持线程等待/阻塞时间统计的Java开发工具包(JDK)版本上时,就会出现此错误。Elasticsearch使用此功能来监控和管理线程使用情况。要解决此问题,您可以升级到支持此功能的JDK版本,或者在Elasticsearch设置中禁用线程等待/阻塞时间统计。或者,您可以切换到支持此功能的其他JDK发行版。 日志上下文 ----------- 日志"thread wait/blocked time accounting is not supported on this JDK"的类名是[HotThreads.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解的人参考: ```java } // Enabling thread contention monitoring is required for capturing JVM thread wait/blocked times. If we weren't // able to enable this functionality during bootstrap; we should not produce HotThreads reports. if (isThreadWaitBlockTimeMonitoringEnabled(threadBean) == false) { throw new ElasticsearchException("thread wait/blocked time accounting is not supported on this JDK"); } StringBuilder sb = new StringBuilder().append("Hot threads at ") .append(DATE_TIME_FORMATTER.format(LocalDateTime.now(Clock.systemUTC()))) .append("; interval=") ```