@Override
  public void unbindFrom(AbstractMetricService metricService) {
    ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();

    metricService.remove(MetricType.AUTO_GAUGE, SystemMetric.JVM_THREADS_PEAK_THREADS.toString());
    metricService.remove(MetricType.AUTO_GAUGE, SystemMetric.JVM_THREADS_DAEMON_THREADS.toString());
    metricService.remove(MetricType.AUTO_GAUGE, SystemMetric.JVM_THREADS_LIVE_THREADS.toString());

    try {
      threadBean.getAllThreadIds();
      for (Thread.State state : Thread.State.values()) {
        metricService.remove(
            MetricType.AUTO_GAUGE,
            SystemMetric.JVM_THREADS_STATUS_THREADS.toString(),
            SystemTag.STATE.toString(),
            getStateTagValue(state));
      }
    } catch (Exception exception) {
      // An error will be thrown for unsupported operations
      // e.g. SubstrateVM does not support getAllThreadIds
    }
  }
This file is modified from io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics
iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/jvm/JvmThreadMetrics.java