func NewSourceManager(instancename string, option *config.Option) *SourceManager { sourcemanager := &SourceManager{} sourcemanager.sourceServers = make(map[string]*SourceServer) sourcemanager.hp2flumeClientPool = make(map[config.HostPort]*pool.FlumePoolLink) sourcemanager.watcherPool = make(map[string]*config.Watcher) //创建使用的Logger basepath := option.LogPath + "/" + instancename sourcemanager.sourceManagerLog = buildLog(basepath, "source_manager", "source_manager.log") sourcemanager.flumeLog = buildLog(basepath, "flume_tps", "flume_tps.log") sourcemanager.flumePoolLog = buildLog(basepath, "flume_pool", "flume_pool.log") sourcemanager.redisLog = buildLog(basepath, "redis_tps", "redis_tps.log") sourcemanager.watcherLog = buildLog(basepath, "zk_watcher", "zk_watcher.log") sourcemanager.flumeSourceLog = buildLog(basepath, "flume_source", "flume_source.log") sourcemanager.redispool = initRedisQueue(option) //从zk中拉取flumenode的配置 zkmanager := config.NewZKManager(option.Zkhost) sourcemanager.zkmanager = zkmanager sourcemanager.instancename = instancename sourcemanager.initSourceServers(option.Businesses, zkmanager) return sourcemanager }
func NewSourceManager(instancename string, option *config.Option) *SourceManager { sourcemanager := &SourceManager{} sourcemanager.sourceServers = make(map[string]*SourceServer) sourcemanager.hp2flumeClientPool = make(map[config.HostPort]*pool.FlumePoolLink) sourcemanager.watcherPool = make(map[string]*config.Watcher) sourcemanager.redisPool = initRedisQueue(option) //从zk中拉取flumenode的配置 zkmanager := config.NewZKManager(option.Zkhost) sourcemanager.zkmanager = zkmanager sourcemanager.instancename = instancename sourcemanager.initSourceServers(option.Businesses, zkmanager) return sourcemanager }