@Override
    public void registerContextPath(final MetaDataRegisterDTO dto) {
        this.checkNamespacePluginRel(dto.getNamespaceId(), PluginEnum.CONTEXT_PATH.getName());
        String name = PluginEnum.CONTEXT_PATH.getName();
        String contextPath = PathUtils.decoratorContextPath(dto.getContextPath());
        String key = LOCK_KEY_PREFIX + contextPath;
        Lock lock = registry.obtain(key);
        if (logger.isDebugEnabled()) {
            logger.debug("register context-path obtain lock for key:{}", key);
        }
        try {
            lock.lock();
            String contextPathSelectorId = getSelectorService().registerDefault(dto, name, "");
            // avoid repeated registration for many client threads
            // many client threads may register the same context path for contextPath plugin at the same time
            if (Objects.nonNull(getRuleService().findBySelectorIdAndName(contextPathSelectorId, dto.getContextPath()))) {
                return;
            }
            ContextMappingRuleHandle handle = new ContextMappingRuleHandle();
            handle.setContextPath(contextPath);
            handle.setAddPrefixed(dto.getAddPrefixed());
            getRuleService().registerDefault(buildContextPathDefaultRuleDTO(contextPathSelectorId, dto, handle.toJson()));
        } finally {
            lock.unlock();
        }
    }
The type Abstract context path register service.
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/register/AbstractContextPathRegisterService.java