func (proto *registryProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
	proto.once.Do(func() {
		proto.initConfigurationListeners()
	})
	registryUrl := getRegistryUrl(invoker)
	providerUrl := getProviderUrl(invoker)

	overriderUrl := getSubscribedOverrideUrl(providerUrl)
	fmt.Print("overriderUrl %s", overriderUrl)
	var reg registry.Registry
	if regI, loaded := proto.registries.Load(registryUrl.Key()); !loaded {
		reg = getRegistry(registryUrl)
		proto.registries.Store(registryUrl.Key(), reg)
		logger.Infof("Export proto:%p registries address:%p", proto, proto.registries)
	} else {
		reg = regI.(registry.Registry)
	}

	registeredProviderUrl := getUrlToRegistry(providerUrl, registryUrl)
	err := reg.Register(registeredProviderUrl)
	if err != nil {
		logger.Errorf("provider service %v register registry %v error, error message is %s",
			providerUrl.Key(), registryUrl.Key(), err.Error())
		return nil
	}

	key := getCacheKey(providerUrl)
	logger.Infof("The cached exporter keys is %v!", key)
	cachedExporter, loaded := proto.bounds.Load(key)
	if loaded {
		logger.Infof("The exporter has been cached, and will return cached exporter!")
	} else {
		wrappedInvoker := newWrappedInvoker(invoker, providerUrl)
		cachedExporter = extension.GetProtocol(protocolwrapper.FILTER).Export(wrappedInvoker)
		proto.bounds.Store(key, cachedExporter)
		logger.Infof("The exporter has not been cached, and will return a new exporter!")
	}

	return cachedExporter.(protocol.Exporter)
}
// Export provider service to registry center
Export provider service to registry center
// Export provider service to registry center
func (proto *registryProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
	proto.once.Do(func() {
		proto.initConfigurationListeners()
	})
	registryUrl := getRegistryUrl(invoker)
	providerUrl := getProviderUrl(invoker)
	overriderUrl := getSubscribedOverrideUrl(providerUrl)
	fmt.Print("overriderUrl %s", overriderUrl)
	var reg registry.Registry
	if regI, loaded := proto.registries.Load(registryUrl.Key()); !loaded {
		reg = getRegistry(registryUrl)
		proto.registries.Store(registryUrl.Key(), reg)
		logger.Infof("Export proto:%p registries address:%p", proto, proto.registries)
	} else {
		reg = regI.(registry.Registry)
	}
	registeredProviderUrl := getUrlToRegistry(providerUrl, registryUrl)
	err := reg.Register(registeredProviderUrl)
	if err != nil {
		logger.Errorf("provider service %v register registry %v error, error message is %s",
			providerUrl.Key(), registryUrl.Key(), err.Error())
		return nil
	}
	key := getCacheKey(providerUrl)
	logger.Infof("The cached exporter keys is %v!", key)
	cachedExporter, loaded := proto.bounds.Load(key)
	if loaded {
		logger.Infof("The exporter has been cached, and will return cached exporter!")
	} else {
		wrappedInvoker := newWrappedInvoker(invoker, providerUrl)
		cachedExporter = extension.GetProtocol(protocolwrapper.FILTER).Export(wrappedInvoker)
		proto.bounds.Store(key, cachedExporter)
		logger.Infof("The exporter has not been cached, and will return a new exporter!")
	}
	return cachedExporter.(protocol.Exporter)
}
func ( proto * registryProtocol ) Export ( invoker protocol . Invoker ) protocol . Exporter { proto . once . Do ( func ( ) { proto . initConfigurationListeners ( ) } ) registryUrl := getRegistryUrl ( invoker ) providerUrl := getProviderUrl ( invoker ) overriderUrl := getSubscribedOverrideUrl ( providerUrl ) fmt . Print ( " " , overriderUrl ) var reg registry . Registry if regI , loaded := proto . registries . Load ( registryUrl . Key ( ) ) ; ! loaded { reg = getRegistry ( registryUrl ) proto . registries . Store ( registryUrl . Key ( ) , reg ) logger . Infof ( " " , proto , proto . registries ) } else { reg = regI . ( registry . Registry ) } registeredProviderUrl := getUrlToRegistry ( providerUrl , registryUrl ) err := reg . Register ( registeredProviderUrl ) if err != nil { logger . Errorf ( " " , providerUrl . Key ( ) , registryUrl . Key ( ) , err . Error ( ) ) return nil } key := getCacheKey ( providerUrl ) logger . Infof ( " " , key ) cachedExporter , loaded := proto . bounds . Load ( key ) if loaded { logger . Infof ( " " ) } else { wrappedInvoker := newWrappedInvoker ( invoker , providerUrl ) cachedExporter = extension . GetProtocol ( protocolwrapper . FILTER ) . Export ( wrappedInvoker ) proto . bounds . Store ( key , cachedExporter ) logger . Infof ( " " ) } return cachedExporter . ( protocol . Exporter ) }
Export provider service to registry center
Export provider service to registry center