amoeba源码分析(一)-AmoebaProxyServer入口类分析 (三)

2014-11-24 11:45:01 · 作者: · 浏览: 43
r(ProxyRuntimeContext.getInstance());
for(ConnectionManager connMgr :ProxyRuntimeContext.getInstance().getConnectionManagerList().values()){
registerReporter(connMgr);
}4 启动每一个注入的服务


[java]
Map context = new HashMap();
context.putAll(ProxyRuntimeContext.getInstance().getConnectionManagerList());

List serviceConfigList = ProxyRuntimeContext.getInstance().getConfig().getServiceConfigList();
//初始化注入的每一个服务,并启动
//amoeba在启动时会启动监控服务和接收服务。用于mysql代理的需要与amoeba_mysql一起使用,因为注入的将会是amoeba_mysql中的服务器
for(BeanObjectEntityConfig serverConfig : serviceConfigList){
Service service = (Service)serverConfig.createBeanObject(false,context);

service.init();
service.start();
//将每一个服务添加到支持优先级处理的释放钩子中
PriorityShutdownHook.addShutdowner(service);
registerReporter(service);
}

Map context = new HashMap();
context.putAll(ProxyRuntimeContext.getInstance().getConnectionManagerList());

List serviceConfigList = ProxyRuntimeContext.getInstance().getConfig().getServiceConfigList();
//初始化注入的每一个服务,并启动
//amoeba在启动时会启动监控服务和接收服务。用于mysql代理的需要与amoeba_mysql一起使用,因为注入的将会是amoeba_mysql中的服务器
for(BeanObjectEntityConfig serverConfig : serviceConfigList){
Service service = (Service)serverConfig.createBeanObject(false,context);

service.init();
service.start();
//将每一个服务添加到支持优先级处理的释放钩子中
PriorityShutdownHook.addShutdowner(service);
registerReporter(service);
}5 最后是开启report监控线程,一分钟执行一次,如果对这块要求不高,可以将时长修改长一点,如10分钟。