class AbstractRegistryFactory implements RegistryFactory {

    private static final ConcurrentHashMap<String, Registry> registries = new ConcurrentHashMap<>();

    private static final ReentrantLock lock = new ReentrantLock();

    protected String getRegistryUri(URL url) {
        return url.getUri();
    }

    @Override
    public Registry getRegistry(URL url) {<FILL_FUNCTION_BODY>}

    protected abstract Registry createRegistry(URL url);
}

        String registryUri = getRegistryUri(url);
        try {
            lock.lock();
            Registry registry = registries.get(registryUri);
            if (registry != null) {
                return registry;
            }
            registry = createRegistry(url);
            if (registry == null) {
                throw new MotanFrameworkException("Create registry false for url:" + url, MotanErrorMsgConstant.FRAMEWORK_INIT_ERROR);
            }
            registries.put(registryUri, registry);
            GlobalRuntime.addRegistry(registryUri, registry);
            return registry;
        } catch (Exception e) {
            throw new MotanFrameworkException("Create registry false for url:" + url, e, MotanErrorMsgConstant.FRAMEWORK_INIT_ERROR);
        } finally {
            lock.unlock();
        }
    
<no_super_class>