提交 b9157e1d 编写于 作者: L lgcareer 提交者: qiaozhanwei

Add alertDao to spring management in master (#976)

* rename from DatasourceUserMapper to DataSourceUserMapper

* add unit test in UserMapper and WorkerGroupMapper

* change cn.escheduler to org.apache.dolphinscheduler

* add unit test in UdfFuncMapperTest

* add unit test in UdfFuncMapperTest

* remove DatabaseConfiguration

* add ConnectionFactoryTest

* cal duration in processInstancesList

* change desc to description

* change table name in mysql ddl

* change table name in mysql ddl

* change escheduler to dolphinscheduler

* change escheduler to dolphinscheduler

* change escheduler to dolphinscheduler

* remove log4j-1.2-api and modify AlertMapperTest

* remove log4j-1.2-api

* Add alertDao to spring management
上级 5448d0c6
......@@ -21,6 +21,7 @@ import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadPoolExecutors;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.server.master.runner.MasterSchedulerThread;
import org.apache.dolphinscheduler.server.quartz.ProcessScheduleJob;
......@@ -64,6 +65,9 @@ public class MasterServer extends AbstractServer {
@Autowired
protected ProcessDao processDao;
@Autowired
protected AlertDao alertDao;
/**
* master exec thread pool
*/
......@@ -71,14 +75,14 @@ public class MasterServer extends AbstractServer {
public MasterServer(){}
public MasterServer(ProcessDao processDao){
public MasterServer(ProcessDao processDao,AlertDao alertDao){
try {
conf = new PropertiesConfiguration(Constants.MASTER_PROPERTIES_PATH);
}catch (ConfigurationException e){
logger.error("load configuration failed : " + e.getMessage(),e);
System.exit(1);
}
zkMasterClient = ZKMasterClient.getZKMasterClient(processDao);
zkMasterClient = ZKMasterClient.getZKMasterClient(processDao,alertDao);
this.masterSchedulerService = ThreadUtils.newDaemonSingleThreadExecutor("Master-Scheduler-Thread");
}
......@@ -98,7 +102,7 @@ public class MasterServer extends AbstractServer {
@Override
public void run(String... strings) throws Exception {
MasterServer masterServer = new MasterServer(processDao);
MasterServer masterServer = new MasterServer(processDao,alertDao);
masterServer.run(processDao);
......
......@@ -85,11 +85,12 @@ public class ZKMasterClient extends AbstractZKClient {
* @param processDao
* @return
*/
public static synchronized ZKMasterClient getZKMasterClient(ProcessDao processDao){
public static synchronized ZKMasterClient getZKMasterClient(ProcessDao processDao,AlertDao alertDao){
if(zkMasterClient == null){
zkMasterClient = new ZKMasterClient(processDao);
}
zkMasterClient.processDao = processDao;
zkMasterClient.alertDao = alertDao;
return zkMasterClient;
}
......@@ -98,8 +99,6 @@ public class ZKMasterClient extends AbstractZKClient {
* init
*/
public void init(){
// init dao
this.initDao();
InterProcessMutex mutex = null;
try {
......@@ -135,14 +134,6 @@ public class ZKMasterClient extends AbstractZKClient {
/**
* init dao
*/
public void initDao(){
this.alertDao = DaoFactory.getDaoInstance(AlertDao.class);
// this.processDao = DaoFactory.getDaoInstance(ProcessDao.class);
}
/**
* get alert dao
* @return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册