class EruptNodeMicroservice {

    @Resource
    private EruptDao eruptDao;

    @Resource
    private NodeManager nodeManager;

    @Resource
    private NodeWorker nodeWorker;

    @Resource
    private EruptCloudServerProp eruptCloudServerProp;

    public CloudNode findNodeByAppName(String nodeName, String accessToken) {<FILL_FUNCTION_BODY>}

    public void registerNode(CloudNode cloudNode, MetaNode metaNode) {
        Optional.ofNullable(nodeManager.getNode(metaNode.getNodeName())).ifPresent(it -> metaNode.getLocations().addAll(it.getLocations()));
        metaNode.getLocations().addAll(Arrays.asList(metaNode.getNodeAddress()));
        metaNode.setRegisterTime(new Date());
        nodeManager.putNode(metaNode);
    }

    public void safeRemoveInstance(String nodeName, String accessToken) {
        this.findNodeByAppName(nodeName, accessToken);
        nodeWorker.run(); // 轮询nodeName下所有ip节点可用情况
    }

}

        CloudNode cloudNode = eruptDao.queryEntity(CloudNode.class, CloudNode.NODE_NAME + " = :" + CloudNode.NODE_NAME, new HashMap<String, Object>() {{
            this.put(CloudNode.NODE_NAME, nodeName);
        }});
        if (null == cloudNode) {
            throw new RuntimeException("NodeName: '" + nodeName + "' not found");
        }
        if (eruptCloudServerProp.isValidateAccessToken()) {
            if (!cloudNode.getAccessToken().equals(accessToken)) {
                throw new RuntimeException(cloudNode.getNodeName() + " Access token invalid");
            }
        }
        return cloudNode;
    
<no_super_class>