private void stopAllInstances() {
        instanceMap.values().forEach((instance) -> {
            notifyDestroyInstance(instance.getInstanceId());
        });
        instanceMap.values().forEach((instance) -> {
            deleteFromMemory(instance.getInstanceId());
        });
        instanceMap.clear();
    }
add instance to memory, if there is a record refer to the instance id exist we need to destroy it first.
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/instance/InstanceManager.java