diff --git a/config/config_loader.go b/config/config_loader.go index 121ef39ff2a676076d9cd104df1dcf2ebc37d840..1ed43ededdf9c8bfeb30c0c8f62b8c9a414246e6 100644 --- a/config/config_loader.go +++ b/config/config_loader.go @@ -102,6 +102,7 @@ func loadConsumerConfig() { metricConfig = consumerConfig.MetricConfig applicationConfig = consumerConfig.ApplicationConfig + extension.SetAndInitGlobalDispatcher(consumerConfig.eventDispatcherType) extension.SetAndInitGlobalDispatcher(consumerConfig.eventDispatcherType) @@ -180,6 +181,7 @@ func loadProviderConfig() { // so, you should know that the consumer's config will be override metricConfig = providerConfig.MetricConfig applicationConfig = providerConfig.ApplicationConfig + extension.SetAndInitGlobalDispatcher(providerConfig.eventDispatcherType) extension.SetAndInitGlobalDispatcher(consumerConfig.eventDispatcherType) @@ -196,6 +198,7 @@ func loadProviderConfig() { } svs.id = key svs.Implement(rpcService) + svs.Protocols = providerConfig.Protocols if err := svs.Export(); err != nil { panic(fmt.Sprintf("service %s export failed! err: %#v", key, err)) } diff --git a/config/service_config.go b/config/service_config.go index 4597c4a0a52ff6cdb11944d92f118373f84fb118..d233e2b8a55facd2ca62f86a7af9f5d6e7e309d5 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -113,6 +113,16 @@ func NewServiceConfig(id string, context context.Context) *ServiceConfig { } } +// InitExported will set exported as false atom bool +func (c *ServiceConfig) InitExported() { + c.exported = atomic.NewBool(false) +} + +// IsExport will return whether the service config is exported or not +func (c *ServiceConfig) IsExport() bool { + return c.exported.Load() +} + // Get Random Port func getRandomPort(protocolConfigs []*ProtocolConfig) *list.List { ports := list.New() @@ -131,16 +141,6 @@ func getRandomPort(protocolConfigs []*ProtocolConfig) *list.List { return ports } -// InitExported will set exported as false atom bool -func (c *ServiceConfig) InitExported() { - c.exported = atomic.NewBool(false) -} - -// IsExport will return whether the service config is exported or not -func (c *ServiceConfig) IsExport() bool { - return c.exported.Load() -} - // Export ... func (c *ServiceConfig) Export() error { // TODO: config center start here diff --git a/config/service_config_test.go b/config/service_config_test.go index efa2cafa3669a406157bd22af8d02930ec71ba48..387e3ced7ad00d9d2240ca5833a36994f707720d 100644 --- a/config/service_config_test.go +++ b/config/service_config_test.go @@ -24,9 +24,6 @@ import ( import ( gxnet "github.com/dubbogo/gost/net" "github.com/stretchr/testify/assert" -) - -import ( "go.uber.org/atomic" )