public int getInstanceNum() {
        int num = 0;
        for (Task task : taskMap.values()) {
            num += task.getInstanceNum();
        }
        return num;
    }
add task to memory, if there is a record refer to the task id exist we need to destroy it first.
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/task/TaskManager.java