Skip to content
Snippets Groups Projects
Commit aca6f801 authored by vito.he's avatar vito.he
Browse files

Mod:recycle refer

parent 067a9e53
No related branches found
No related tags found
No related merge requests found
......@@ -15,26 +15,27 @@
* limitations under the License.
*/
package metadata
package instance
import (
"sync"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/extension"
"sync"
"github.com/apache/dubbo-go/metadata"
)
var (
instance MetadataReport
instance metadata.MetadataReport
once sync.Once
)
// GetEnvInstance ...
func Init(url *common.URL) {
// GetMetadataReportInstance ...
func GetMetadataReportInstance(url *common.URL) metadata.MetadataReport {
once.Do(func() {
instance = extension.GetMetadataReportFactory(url.Protocol).createMetadataReport(url)
instance = extension.GetMetadataReportFactory(url.Protocol).CreateMetadataReport(url)
})
}
func GetMetadataReportInstance() MetadataReport {
return instance
}
......@@ -18,9 +18,9 @@
package config
import (
"github.com/apache/dubbo-go/metadata"
"net/url"
)
import (
"github.com/creasty/defaults"
perrors "github.com/pkg/errors"
......@@ -29,6 +29,7 @@ import (
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/config/instance"
)
// MethodConfig ...
......@@ -93,7 +94,7 @@ func startMetadataReport() error {
return perrors.New("MetadataConfig address can not be empty.")
}
if url, err := consumerConfig.MetadataReportConfig.ToUrl(); err == nil {
metadata.Init(url)
instance.GetMetadataReportInstance(url)
} else {
return perrors.New("MetadataConfig is invalid!")
}
......
......@@ -24,5 +24,5 @@ var (
)
type MetadataReportFactory interface {
createMetadataReport(*common.URL) MetadataReport
CreateMetadataReport(*common.URL) MetadataReport
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment