private void removeRuleData(final ShenyuTrieNode currentNode, final String[] pathParts,
                                final RuleData ruleData, final List<?> collection) {
        // check current mapping
        List<RuleData> ruleDataList = ListUtil.castList(collection, RuleData.class::cast);
        synchronized (ruleData.getId()) {
            ruleDataList.removeIf(rule -> ruleData.getId().equals(rule.getId()));
        }
        currentNode.getPathCache().put(ruleData.getSelectorId(), ruleDataList);
        if (CollectionUtils.isEmpty(ruleDataList) && Objects.isNull(currentNode.getChildren())
                && Objects.isNull(currentNode.getPathVariables())) {
            removeData(pathParts, ruleData.getSelectorId());
        }
    }
remove rule data.

@param currentNode current node
@param pathParts path parts
@param ruleData rule data
@param collection rule data list
shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/trie/ShenyuTrie.java