Exemple #1
0
func (top *Topology) Close(proxyName string) {
	// delete fence znode
	pi, err := models.GetProxyInfo(top.zkConn, top.ProductName, proxyName)
	if err != nil {
		log.Errorf("killing fence error, proxy %s is not exists", proxyName)
	} else {
		zkhelper.DeleteRecursive(top.zkConn, path.Join(models.GetProxyFencePath(top.ProductName), pi.Addr), -1)
	}
	// delete ephemeral znode
	zkhelper.DeleteRecursive(top.zkConn, path.Join(models.GetProxyPath(top.ProductName), proxyName), -1)
	top.zkConn.Close()
}
Exemple #2
0
func (top *Topology) GetProxyInfo(proxyName string) (*models.ProxyInfo, error) {
	var err error
	var proxy *models.ProxyInfo
	for {
		proxy, err = models.GetProxyInfo(top.zkConn, top.ProductName, proxyName)
		if err == nil || top.IsFatalErr(err) {
			break
		} else {
			time.Sleep(ZK_RECONNECT_INTERVAL * time.Second)
		}
		if err != nil {
			log.ErrorErrorf(err, "GetProxyInfo ")
			proxy = nil
		}
	}
	return proxy, err
}
Exemple #3
0
func (top *Topology) GetProxyInfo(proxyName string) (*models.ProxyInfo, error) {
	return models.GetProxyInfo(top.zkConn, top.ProductName, proxyName)
}