Skip to content
Snippets Groups Projects
dubbo_exporter.go 771 B
Newer Older
package dubbo

fangyincheng's avatar
fangyincheng committed
import (
	log "github.com/AlexStocks/log4go"
)

import (
	"github.com/dubbo/go-for-apache-dubbo/common"
	"github.com/dubbo/go-for-apache-dubbo/common/constant"
	"github.com/dubbo/go-for-apache-dubbo/protocol"
fangyincheng's avatar
fangyincheng committed
)

type DubboExporter struct {
	protocol.BaseExporter
func NewDubboExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map) *DubboExporter {
fangyincheng's avatar
fangyincheng committed
	return &DubboExporter{
		BaseExporter: *protocol.NewBaseExporter(key, invoker, exporterMap),
fangyincheng's avatar
fangyincheng committed
	}
}

func (de *DubboExporter) Unexport() {
	service := de.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "")
	de.BaseExporter.Unexport()
	err := common.ServiceMap.UnRegister(DUBBO, service)
	if err != nil {
		log.Error("[DubboExporter.Unexport] error: %v", err)
	}
}