• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang exit.Recover函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/youtube/vitess/go/exit.Recover函数的典型用法代码示例。如果您正苦于以下问题:Golang Recover函数的具体用法?Golang Recover怎么用?Golang Recover使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Recover函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()

	zknsDomain := flag.String("zkns-domain", "", "The naming hierarchy portion to serve")
	zknsRoot := flag.String("zkns-root", "", "The root path from which to resolve")
	bindAddr := flag.String("bind-addr", ":31981", "Bind the debug http server")
	flag.Parse()

	if *bindAddr != "" {
		go func() {
			err := http.ListenAndServe(*bindAddr, nil)
			if err != nil {
				log.Errorf("ListenAndServe: %s", err)
				exit.Return(1)
			}
		}()
	}

	zconn := zk.NewMetaConn()
	fqdn := netutil.FullyQualifiedHostnameOrPanic()
	zr1 := newZknsResolver(zconn, fqdn, *zknsDomain, *zknsRoot)
	pd := &pdns{zr1}
	pd.Serve(os.Stdin, os.Stdout)
	os.Stdout.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:26,代码来源:pdns.go


示例2: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	ts := topo.GetServer()
	defer topo.CloseServers()

	resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")

	healthCheck = discovery.NewHealthCheck(*healthCheckConnTimeout, *healthCheckRetryDelay, *healthCheckTimeout)
	healthCheck.RegisterStats()

	tabletTypes := make([]topodatapb.TabletType, 0, 1)
	if len(*tabletTypesToWait) != 0 {
		for _, ttStr := range strings.Split(*tabletTypesToWait, ",") {
			tt, err := topoproto.ParseTabletType(ttStr)
			if err != nil {
				log.Errorf("unknown tablet type: %v", ttStr)
				continue
			}
			tabletTypes = append(tabletTypes, tt)
		}
	}
	l2vtg := l2vtgate.Init(healthCheck, ts, resilientSrvTopoServer, *cell, *retryCount, tabletTypes)

	servenv.OnRun(func() {
		addStatusParts(l2vtg)
	})
	servenv.RunDefault()
}
开发者ID:jmptrader,项目名称:vitess,代码行数:32,代码来源:main.go


示例3: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage of %v:\n", os.Args[0])
		flag.PrintDefaults()
		fmt.Fprintf(os.Stderr, doc)
	}
	flag.Parse()
	args := flag.Args()
	if len(args) == 0 {
		flag.Usage()
		exit.Return(1)
	}

	if *zkAddrs != "" {
		var err error
		zconn, _, err = zk.DialZkTimeout(*zkAddrs, 5*time.Second, 10*time.Second)
		if err != nil {
			log.Errorf("zk connect failed: %v", err.Error())
			exit.Return(1)
		}
	}

	cmdName := args[0]
	args = args[1:]
	if cmd, ok := cmdMap[cmdName]; ok {
		subFlags := flag.NewFlagSet(cmdName, flag.ExitOnError)
		if err := cmd(subFlags, args); err != nil {
			log.Error(err)
			exit.Return(1)
		}
	}
}
开发者ID:CowLeo,项目名称:vitess,代码行数:34,代码来源:zkcmd.go


示例4: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	if initFakeZK != nil {
		initFakeZK()
	}
	ts := topo.GetServer()
	defer topo.CloseServers()

	resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")

	healthCheck = discovery.NewHealthCheck(*connTimeoutTotal, *healthCheckRetryDelay, *healthCheckTimeout, "" /* statsSuffix */)

	tabletTypes := make([]topodatapb.TabletType, 0, 1)
	if len(*tabletTypesToWait) != 0 {
		for _, ttStr := range strings.Split(*tabletTypesToWait, ",") {
			tt, err := topoproto.ParseTabletType(ttStr)
			if err != nil {
				log.Errorf("unknown tablet type: %v", ttStr)
				continue
			}
			tabletTypes = append(tabletTypes, tt)
		}
	}
	vtg := vtgate.Init(context.Background(), healthCheck, ts, resilientSrvTopoServer, *cell, *retryDelay, *retryCount, *connTimeoutTotal, *connTimeoutPerConn, *connLife, tabletTypes, *maxInFlight, *testGateway)

	servenv.OnRun(func() {
		addStatusParts(vtg)
	})
	servenv.RunDefault()
}
开发者ID:aaijazi,项目名称:vitess,代码行数:34,代码来源:vtgate.go


示例5: main

func main() {
	defer exit.Recover()

	flag.Parse()

	err := vtctlclient.RunCommandAndWait(
		context.Background(), *server, flag.Args(),
		*dialTimeout, *actionTimeout,
		func(e *logutil.LoggerEvent) {
			switch e.Level {
			case logutil.LOGGER_INFO:
				log.Info(e.String())
			case logutil.LOGGER_WARNING:
				log.Warning(e.String())
			case logutil.LOGGER_ERROR:
				log.Error(e.String())
			case logutil.LOGGER_CONSOLE:
				fmt.Print(e.String())
			}
		})
	if err != nil {
		log.Error(err)
		os.Exit(1)
	}
}
开发者ID:hadmagic,项目名称:vitess,代码行数:25,代码来源:main.go


示例6: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()

	flag.Parse()

	zkConfig := zkctl.MakeZkConfigFromString(*zkCfg, uint32(*myId))
	zkd := zkctl.NewZkd(zkConfig)

	if zkd.Inited() {
		log.Infof("already initialized, starting without init...")
		if err := zkd.Start(); err != nil {
			log.Errorf("failed start: %v", err)
			exit.Return(255)
		}
	} else {
		log.Infof("initializing...")
		if err := zkd.Init(); err != nil {
			log.Errorf("failed init: %v", err)
			exit.Return(255)
		}
	}

	log.Infof("waiting for signal or server shutdown...")
	sig := make(chan os.Signal)
	signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
	select {
	case <-zkd.Done():
		log.Infof("server shut down on its own")
	case <-sig:
		log.Infof("signal received, shutting down server")
		zkd.Shutdown()
	}
}
开发者ID:CowLeo,项目名称:vitess,代码行数:34,代码来源:zkctld.go


示例7: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()

	flag.Parse()
	args := flag.Args()

	if len(args) == 0 {
		flag.Usage()
		exit.Return(1)
	}

	zkConfig := zkctl.MakeZkConfigFromString(*zkCfg, uint32(*myID))
	zkd := zkctl.NewZkd(zkConfig)

	action := flag.Arg(0)
	var err error
	switch action {
	case "init":
		err = zkd.Init()
	case "shutdown":
		err = zkd.Shutdown()
	case "start":
		err = zkd.Start()
	case "teardown":
		err = zkd.Teardown()
	default:
		log.Errorf("invalid action: %v", action)
		exit.Return(1)
	}
	if err != nil {
		log.Errorf("failed %v: %v", action, err)
		exit.Return(1)
	}
}
开发者ID:erzel,项目名称:vitess,代码行数:35,代码来源:zkctl.go


示例8: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()

	flag.Parse()
	args := flag.Args()
	if len(args) == 0 {
		flag.Usage()
		exit.Return(1)
	}

	if *cpuProfile != "" {
		f, err := os.Create(*cpuProfile)
		if err != nil {
			log.Error(err)
			exit.Return(1)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	ctx := context.Background()
	if *mode == "getSrvKeyspaceNames" {
		rpcClient := connect()
		if len(args) == 1 {
			getSrvKeyspaceNames(ctx, rpcClient, args[0], true)
		} else {
			log.Errorf("getSrvKeyspaceNames only takes one argument")
			exit.Return(1)
		}

	} else if *mode == "getSrvKeyspace" {
		rpcClient := connect()
		if len(args) == 2 {
			getSrvKeyspace(ctx, rpcClient, args[0], args[1], true)
		} else {
			log.Errorf("getSrvKeyspace only takes two arguments")
			exit.Return(1)
		}

	} else if *mode == "getEndPoints" {
		rpcClient := connect()
		if len(args) == 4 {
			getEndPoints(ctx, rpcClient, args[0], args[1], args[2], args[3], true)
		} else {
			log.Errorf("getEndPoints only takes four arguments")
			exit.Return(1)
		}

	} else if *mode == "qps" {
		qps(ctx, args[0], args[1:])

	} else {
		flag.Usage()
		log.Errorf("Invalid mode: %v", *mode)
		exit.Return(1)
	}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:58,代码来源:zkclient2.go


示例9: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	if initFakeZK != nil {
		initFakeZK()
	}
	ts := topo.GetServer()
	defer topo.CloseServers()

	var schema *planbuilder.Schema
	if *schemaFile != "" {
		var err error
		if schema, err = planbuilder.LoadFile(*schemaFile); err != nil {
			log.Error(err)
			exit.Return(1)
		}
		log.Infof("v3 is enabled: loaded schema from file: %v", *schemaFile)
	} else {
		ctx := context.Background()
		schemaJSON, err := ts.GetVSchema(ctx)
		if err != nil {
			log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
			goto startServer
		}
		schema, err = planbuilder.NewSchema([]byte(schemaJSON))
		if err != nil {
			log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
			goto startServer
		}
		log.Infof("v3 is enabled: loaded schema from topo")
	}

startServer:
	resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")

	healthCheck = discovery.NewHealthCheck(*connTimeoutTotal, *healthCheckRetryDelay, *healthCheckTimeout, "" /* statsSuffix */)

	tabletTypes := make([]topodatapb.TabletType, 0, 1)
	if len(*tabletTypesToWait) != 0 {
		for _, ttStr := range strings.Split(*tabletTypesToWait, ",") {
			tt, err := topoproto.ParseTabletType(ttStr)
			if err != nil {
				log.Errorf("unknown tablet type: %v", ttStr)
				continue
			}
			tabletTypes = append(tabletTypes, tt)
		}
	}
	vtg := vtgate.Init(healthCheck, ts, resilientSrvTopoServer, schema, *cell, *retryDelay, *retryCount, *connTimeoutTotal, *connTimeoutPerConn, *connLife, tabletTypes, *maxInFlight, *testGateway)

	servenv.OnRun(func() {
		addStatusParts(vtg)
	})
	servenv.RunDefault()
}
开发者ID:Rastusik,项目名称:vitess,代码行数:58,代码来源:vtgate.go


示例10: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()

	dbconfigs.RegisterFlags()
	flag.Parse()

	mycnf := mysqlctl.NewMycnf(uint32(*tabletUid), *mysqlPort)
	if *mysqlSocket != "" {
		mycnf.SocketFile = *mysqlSocket
	}

	dbcfgs, err := dbconfigs.Init(mycnf.SocketFile)
	if err != nil {
		log.Errorf("%v", err)
		exit.Return(255)
	}
	mysqld = mysqlctl.NewMysqld("Dba", mycnf, &dbcfgs.Dba, &dbcfgs.Repl)

	// Register OnTerm handler before mysqld starts, so we get notified if mysqld
	// dies on its own without us (or our RPC client) telling it to.
	mysqldTerminated := make(chan struct{})
	mysqld.OnTerm(func() {
		close(mysqldTerminated)
	})

	// Start or Init mysqld as needed.
	if _, err = os.Stat(mycnf.DataDir); os.IsNotExist(err) {
		log.Infof("mysql data dir (%s) doesn't exist, initializing", mycnf.DataDir)
		mysqld.Init(*waitTime, *bootstrapArchive, *skipSchema)
	} else {
		log.Infof("mysql data dir (%s) already exists, starting without init", mycnf.DataDir)
		mysqld.Start(*waitTime)
	}

	servenv.Init()
	defer servenv.Close()

	// Take mysqld down with us on SIGTERM before entering lame duck.
	servenv.OnTerm(func() {
		log.Infof("mysqlctl received SIGTERM, shutting down mysqld first")
		mysqld.Shutdown(false, 0)
	})

	// Start RPC server and wait for SIGTERM.
	mysqlctldTerminated := make(chan struct{})
	go func() {
		servenv.RunDefault()
		close(mysqlctldTerminated)
	}()

	select {
	case <-mysqldTerminated:
		log.Infof("mysqld shut down on its own, exiting mysqlctld")
	case <-mysqlctldTerminated:
		log.Infof("mysqlctld shut down gracefully")
	}
}
开发者ID:plobsing,项目名称:vitess,代码行数:58,代码来源:mysqlctld.go


示例11: main

func main() {
	defer exit.Recover()

	// flag parsing
	flags := dbconfigs.AppConfig | dbconfigs.DbaConfig |
		dbconfigs.FilteredConfig | dbconfigs.ReplConfig
	dbconfigs.RegisterFlags(flags)
	mysqlctl.RegisterFlags()
	flag.Parse()
	if len(flag.Args()) > 0 {
		flag.Usage()
		log.Errorf("vtcombo doesn't take any positional arguments")
		exit.Return(1)
	}

	// register topo server
	topo.RegisterServer("fakezk", zktopo.NewServer(fakezk.NewConn()))
	ts := topo.GetServerByName("fakezk")

	servenv.Init()

	// database configs
	mycnf, err := mysqlctl.NewMycnfFromFlags(0)
	if err != nil {
		log.Errorf("mycnf read failed: %v", err)
		exit.Return(1)
	}
	dbcfgs, err := dbconfigs.Init(mycnf.SocketFile, flags)
	if err != nil {
		log.Warning(err)
	}
	mysqld := mysqlctl.NewMysqld("Dba", "App", mycnf, &dbcfgs.Dba, &dbcfgs.App.ConnParams, &dbcfgs.Repl)

	// tablets configuration and init
	binlog.RegisterUpdateStreamService(mycnf)
	initTabletMap(ts, *topology, mysqld, dbcfgs, mycnf)

	// vtgate configuration and init
	resilientSrvTopoServer := vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")
	healthCheck := discovery.NewHealthCheck(30*time.Second /*connTimeoutTotal*/, 1*time.Millisecond /*retryDelay*/)
	vtgate.Init(healthCheck, ts, resilientSrvTopoServer, nil /*schema*/, cell, 1*time.Millisecond /*retryDelay*/, 2 /*retryCount*/, 30*time.Second /*connTimeoutTotal*/, 10*time.Second /*connTimeoutPerConn*/, 365*24*time.Hour /*connLife*/, 0 /*maxInFlight*/, "" /*testGateway*/)

	servenv.OnTerm(func() {
		// FIXME(alainjobart) stop vtgate, all tablets
		//		qsc.DisallowQueries()
		//		agent.Stop()
	})
	servenv.OnClose(func() {
		// We will still use the topo server during lameduck period
		// to update our state, so closing it in OnClose()
		topo.CloseServers()
	})
	servenv.RunDefault()
}
开发者ID:richarwu,项目名称:vitess,代码行数:54,代码来源:main.go


示例12: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	// The implementation chain.
	s := services.CreateServices()
	for _, f := range vtgate.RegisterVTGates {
		f(s)
	}

	servenv.RunDefault()
}
开发者ID:littleyang,项目名称:vitess,代码行数:14,代码来源:main.go


示例13: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	// The implementation chain.
	c := newErrorClient(newSuccessClient(newTerminalClient()))
	for _, f := range vtgate.RegisterVTGates {
		f(c)
	}

	servenv.RunDefault()
}
开发者ID:haoqoo,项目名称:vitess,代码行数:14,代码来源:main.go


示例14: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	ts := topo.GetServer()
	defer topo.CloseServers()

	var schema *planbuilder.Schema
	if *schemaFile != "" {
		var err error
		if schema, err = planbuilder.LoadFile(*schemaFile); err != nil {
			log.Error(err)
			exit.Return(1)
		}
		log.Infof("v3 is enabled: loaded schema from file: %v", *schemaFile)
	} else {
		schemafier, ok := ts.(topo.Schemafier)
		if !ok {
			log.Infof("Skipping v3 initialization: topo does not suppurt schemafier interface")
			goto startServer
		}
		ctx := context.Background()
		schemaJSON, err := schemafier.GetVSchema(ctx)
		if err != nil {
			log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
			goto startServer
		}
		schema, err = planbuilder.NewSchema([]byte(schemaJSON))
		if err != nil {
			log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
			goto startServer
		}
		log.Infof("v3 is enabled: loaded schema from topo")
	}

startServer:
	resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")

	// For the initial phase vtgate is exposing
	// topoReader api. This will be subsumed by
	// vtgate once vtgate's client functions become active.
	topoReader = NewTopoReader(resilientSrvTopoServer)
	servenv.Register("toporeader", topoReader)

	vtgate.Init(resilientSrvTopoServer, schema, *cell, *retryDelay, *retryCount, *connTimeoutTotal, *connTimeoutPerConn, *connLife, *maxInFlight)
	servenv.RunDefault()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:49,代码来源:vtgate.go


示例15: main

func main() {
	defer exit.Recover()
	defer logutil.Flush()

	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage: %s [global parameters] command [command parameters]\n", os.Args[0])

		fmt.Fprintf(os.Stderr, "\nThe global optional parameters are:\n")
		flag.PrintDefaults()

		fmt.Fprintf(os.Stderr, "\nThe commands are listed below. Use '%s <command> -h' for more help.\n\n", os.Args[0])
		for _, cmd := range commands {
			fmt.Fprintf(os.Stderr, "  %s", cmd.name)
			if cmd.params != "" {
				fmt.Fprintf(os.Stderr, " %s", cmd.params)
			}
			fmt.Fprintf(os.Stderr, "\n")
		}
		fmt.Fprintf(os.Stderr, "\n")
	}

	dbconfigs.RegisterFlags(dbconfigFlags)
	flag.Parse()

	tabletAddr = netutil.JoinHostPort("localhost", int32(*port))

	action := flag.Arg(0)
	for _, cmd := range commands {
		if cmd.name == action {
			subFlags := flag.NewFlagSet(action, flag.ExitOnError)
			subFlags.Usage = func() {
				fmt.Fprintf(os.Stderr, "Usage: %s %s %s\n\n", os.Args[0], cmd.name, cmd.params)
				fmt.Fprintf(os.Stderr, "%s\n\n", cmd.help)
				subFlags.PrintDefaults()
			}

			if err := cmd.method(subFlags, flag.Args()[1:]); err != nil {
				log.Error(err)
				exit.Return(1)
			}
			return
		}
	}
	log.Errorf("invalid action: %v", action)
	exit.Return(1)
}
开发者ID:xujianhai,项目名称:vitess,代码行数:46,代码来源:mysqlctl.go


示例16: main

func main() {
	defer exit.Recover()

	flag.Parse()

	logger := logutil.NewConsoleLogger()

	err := vtctlclient.RunCommandAndWait(
		context.Background(), *server, flag.Args(),
		*dialTimeout, *actionTimeout,
		func(e *logutilpb.Event) {
			logutil.LogEvent(logger, e)
		})
	if err != nil {
		log.Error(err)
		os.Exit(1)
	}
}
开发者ID:aaijazi,项目名称:vitess,代码行数:18,代码来源:main.go


示例17: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	if initFakeZK != nil {
		initFakeZK()
	}
	ts := topo.GetServer()
	defer topo.CloseServers()

	var schema *planbuilder.Schema
	if *schemaFile != "" {
		var err error
		if schema, err = planbuilder.LoadFile(*schemaFile); err != nil {
			log.Error(err)
			exit.Return(1)
		}
		log.Infof("v3 is enabled: loaded schema from file: %v", *schemaFile)
	} else {
		ctx := context.Background()
		schemaJSON, err := ts.GetVSchema(ctx)
		if err != nil {
			log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
			goto startServer
		}
		schema, err = planbuilder.NewSchema([]byte(schemaJSON))
		if err != nil {
			log.Warningf("Skipping v3 initialization: GetVSchema failed: %v", err)
			goto startServer
		}
		log.Infof("v3 is enabled: loaded schema from topo")
	}

startServer:
	resilientSrvTopoServer = vtgate.NewResilientSrvTopoServer(ts, "ResilientSrvTopoServer")

	healthCheck = discovery.NewHealthCheck(*connTimeoutTotal, *healthCheckRetryDelay)

	vtgate.Init(healthCheck, ts, resilientSrvTopoServer, schema, *cell, *retryDelay, *retryCount, *connTimeoutTotal, *connTimeoutPerConn, *connLife, *maxInFlight, *testGateway)
	servenv.RunDefault()
}
开发者ID:hadmagic,项目名称:vitess,代码行数:43,代码来源:vtgate.go


示例18: main

func main() {
	defer exit.Recover()
	flag.Parse()
	for _, filename := range flag.Args() {
		fmt.Printf("processing: %s\n", filename)
		if err := processFile(filename); err != nil {
			log.Errorf("processFile error: %v", err)
			exit.Return(1)
		}
	}
	var stats = make(stats, 0, 128)
	for k, v := range queries {
		stats = append(stats, stat{Query: k, Count: v})
	}
	sort.Sort(stats)
	for _, s := range stats {
		fmt.Printf("%d: %s\n", s.Count, s.Query)
	}
}
开发者ID:CowLeo,项目名称:vitess,代码行数:19,代码来源:query_analyzer.go


示例19: main

func main() {
	defer exit.Recover()

	flag.Parse()
	args := flag.Args()

	servenv.Init()
	defer servenv.Close()

	ts := topo.GetServer()
	defer topo.CloseServers()

	wi = worker.NewInstance(ts, *cell, *commandDisplayInterval)
	wi.InstallSignalHandlers()
	wi.InitStatusHandling()

	if len(args) == 0 {
		// In interactive mode, initialize the web UI to choose a command.
		wi.InitInteractiveMode()
	} else {
		// In single command mode, just run it.
		worker, done, err := wi.RunCommand(context.Background(), args, nil /*custom wrangler*/, true /*runFromCli*/)
		if err != nil {
			log.Error(err)
			exit.Return(1)
		}
		// Run the subsequent, blocking wait asynchronously.
		go func() {
			if err := wi.WaitForCommand(worker, done); err != nil {
				log.Error(err)
				logutil.Flush()
				// We cannot use exit.Return() here because we are in a different go routine now.
				os.Exit(1)
			}
			logutil.Flush()
			os.Exit(0)
		}()
	}

	servenv.RunDefault()
}
开发者ID:dumbunny,项目名称:vitess,代码行数:41,代码来源:vtworker.go


示例20: main

func main() {
	defer exit.Recover()

	flag.Parse()
	servenv.Init()

	ts := topo.GetServer()

	scheduler, err := janitor.New(*keyspace, *shard, ts, wrangler.New(logutil.NewConsoleLogger(), ts, tmclient.NewTabletManagerClient()), *sleepTime)
	if err != nil {
		log.Errorf("janitor.New: %v", err)
		exit.Return(1)
	}

	if len(activeModules)+len(dryRunModules) < 1 {
		log.Error("no modules to run specified")
		exit.Return(1)
	}

	scheduler.Enable(activeModules)
	scheduler.EnableDryRun(dryRunModules)
	go scheduler.Run()
	servenv.RunDefault()
}
开发者ID:littleyang,项目名称:vitess,代码行数:24,代码来源:vtjanitor.go



注:本文中的github.com/youtube/vitess/go/exit.Recover函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang exit.Return函数代码示例发布时间:2022-05-28
下一篇:
Golang event.DispatchUpdate函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap