private void finishInstance(InstanceProfile profile) {
        profile.setState(InstanceStateEnum.FINISHED);
        profile.setModifyTime(AgentUtils.getCurrentTime());
        addToStore(profile, false);
        deleteFromMemory(profile.getInstanceId());
        LOGGER.info("finished instance state {} taskId {} instanceId {}", profile.getState(),
                profile.getTaskId(), profile.getInstanceId());
    }
thread for core thread.

@return runnable profile.
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/instance/InstanceManager.java