private void checkModules() {
        LOGGER.info("check modules start");
        currentModules.values().forEach((module) -> {
            LOGGER.info("check module {}({}) current state {}", module.getId(), module.getName(), module.getState());
            switch (module.getState()) {
                case NEW:
                    if (downloadModule(module)) {
                        saveModuleState(module.getId(), ModuleStateEnum.DOWNLOADED);
                    } else {
                        LOGGER.error("download module {}({}) failed, keep state in new", module.getId(),
                                module.getName());
                    }
                    break;
                case DOWNLOADED:
                    if (isPackageDownloaded(module)) {
                        installModule(module);
                        saveModuleState(module.getId(), ModuleStateEnum.INSTALLED);
                    } else {
                        LOGGER.info(
                                "check module {}({}) package failed, change stated to new, will download package again",
                                module.getId(), module.getName());
                        saveModuleState(module.getId(), ModuleStateEnum.NEW);
                    }
                    break;
                case INSTALLED:
                    if (!isProcessAllStarted(module, CHECK_PROCESS_TIMES)) {
                        LOGGER.info("module {}({}) process not all started try to start", module.getId(),
                                module.getName());
                        if (!startModule(module)) {
                            LOGGER.info("start module {}({}) failed, change state to downloaded", module.getId(),
                                    module.getName());
                            saveModuleState(module.getId(), ModuleStateEnum.DOWNLOADED);
                        }
                    }
                    break;
                default:
                    LOGGER.error("module {}({}) invalid state {}", module.getId(), module.getName(), module.getState());
            }
        });
        LOGGER.info("check modules end");
    }
Thread for core thread.

@return runnable profile.
inlong-agent/agent-installer/src/main/java/org/apache/inlong/agent/installer/ModuleManager.java