@Override
    public Status check() {
        DataStore dataStore =
                applicationModel.getExtensionLoader(DataStore.class).getDefaultExtension();
        Map<String, Object> executors = dataStore.get(CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY);

        StringBuilder msg = new StringBuilder();
        Status.Level level = Status.Level.OK;
        for (Map.Entry<String, Object> entry : executors.entrySet()) {
            String port = entry.getKey();
            ExecutorService executor = (ExecutorService) entry.getValue();

            if (executor instanceof ThreadPoolExecutor) {
                ThreadPoolExecutor tp = (ThreadPoolExecutor) executor;
                boolean ok = tp.getActiveCount() < tp.getMaximumPoolSize() - 1;
                Status.Level lvl = Status.Level.OK;
                if (!ok) {
                    level = Status.Level.WARN;
                    lvl = Status.Level.WARN;
                }

                if (msg.length() > 0) {
                    msg.append(';');
                }
                msg.append("Pool status:")
                        .append(lvl)
                        .append(", max:")
                        .append(tp.getMaximumPoolSize())
                        .append(", core:")
                        .append(tp.getCorePoolSize())
                        .append(", largest:")
                        .append(tp.getLargestPoolSize())
                        .append(", active:")
                        .append(tp.getActiveCount())
                        .append(", task:")
                        .append(tp.getTaskCount())
                        .append(", service port: ")
                        .append(port);
            }
        }
        return msg.length() == 0 ? new Status(Status.Level.UNKNOWN) : new Status(level, msg.toString());
    }
@Test
    void test() {
        DataStore dataStore =
                ExtensionLoader.getExtensionLoader(DataStore.class).getDefaultExtension();
        ExecutorService executorService1 = Executors.newFixedThreadPool(1);
        ExecutorService executorService2 = Executors.newFixedThreadPool(10);
        dataStore.put(CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY, "8888", executorService1);
        dataStore.put(CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY, "8889", executorService2);

        ThreadPoolStatusChecker threadPoolStatusChecker = new ThreadPoolStatusChecker(ApplicationModel.defaultModel());
        Status status = threadPoolStatusChecker.check();
        Assertions.assertEquals(status.getLevel(), Status.Level.WARN);
        Assertions.assertEquals(
                status.getMessage(),
                "Pool status:WARN, max:1, core:1, largest:0, active:0, task:0, service port: 8888;"
                        + "Pool status:OK, max:10, core:10, largest:0, active:0, task:0, service port: 8889");

        // reset
        executorService1.shutdown();
        executorService2.shutdown();
        dataStore.remove(CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY, "8888");
        dataStore.remove(CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY, "8889");
    }