提交 a75859c9 编写于 作者: T Tboy 提交者: bao liang

using conf.getInt instead of getString (#1010)

* move updateTaskState into try/catch block in case of exception

* fix NPE

* using conf.getInt instead of getString

* for AbstractZKClient, remove the log, for it will print the same log message in createZNodePath.
for AlertDao, correct the spelling.

* duplicate

* refactor getTaskWorkerGroupId

* add friendly log
上级 bfc69edc
......@@ -78,16 +78,16 @@ public abstract class AbstractZKClient {
// retry strategy
RetryPolicy retryPolicy = new ExponentialBackoffRetry(
Integer.parseInt(conf.getString(Constants.ZOOKEEPER_RETRY_SLEEP)),
Integer.parseInt(conf.getString(Constants.ZOOKEEPER_RETRY_MAXTIME)));
conf.getInt(Constants.ZOOKEEPER_RETRY_SLEEP),
conf.getInt(Constants.ZOOKEEPER_RETRY_MAXTIME));
try{
// crate zookeeper client
zkClient = CuratorFrameworkFactory.builder()
.connectString(getZookeeperQuorum())
.retryPolicy(retryPolicy)
.sessionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_SESSION_TIMEOUT)))
.connectionTimeoutMs(1000 * Integer.parseInt(conf.getString(Constants.ZOOKEEPER_CONNECTION_TIMEOUT)))
.sessionTimeoutMs(1000 * conf.getInt(Constants.ZOOKEEPER_SESSION_TIMEOUT))
.connectionTimeoutMs(1000 * conf.getInt(Constants.ZOOKEEPER_CONNECTION_TIMEOUT))
.build();
zkClient.start();
......@@ -240,7 +240,6 @@ public abstract class AbstractZKClient {
return registerPath;
}
registerPath = createZNodePath(zkNodeType);
logger.info("register {} node {} success", zkNodeType.toString(), registerPath);
// handle dead server
handleDeadServer(registerPath, zkNodeType, Constants.DELETE_ZK_OP);
......
......@@ -162,11 +162,11 @@ public class AlertDao extends AbstractBaseDao {
/**
* list user information by alert group id
* @param alergroupId
* @param alertgroupId
* @return
*/
public List<User> listUserByAlertgroupId(int alergroupId){
return userAlertGroupMapper.listUserByAlertgroupId(alergroupId);
public List<User> listUserByAlertgroupId(int alertgroupId){
return userAlertGroupMapper.listUserByAlertgroupId(alertgroupId);
}
......
......@@ -1686,18 +1686,18 @@ public class ProcessDao extends AbstractBaseDao {
*/
public int getTaskWorkerGroupId(TaskInstance taskInstance) {
int taskWorkerGroupId = taskInstance.getWorkerGroupId();
int processInstanceId = taskInstance.getProcessInstanceId();
if(taskWorkerGroupId > 0){
return taskWorkerGroupId;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if(processInstance == null){
logger.error("cannot find the task:{} process instance", taskInstance.getId());
return Constants.DEFAULT_WORKER_ID;
if(processInstance != null){
return processInstance.getWorkerGroupId();
}
int processWorkerGroupId = processInstance.getWorkerGroupId();
taskWorkerGroupId = (taskWorkerGroupId <= 0 ? processWorkerGroupId : taskWorkerGroupId);
return taskWorkerGroupId;
logger.info("task : {} will use default worker group id", taskInstance.getId());
return Constants.DEFAULT_WORKER_ID;
}
public List<Project> getProjectListHavePerm(int userId){
......
......@@ -485,7 +485,6 @@ export default {
'taskManager':'taskManage数量',
'jobManagerMemory':'jobManager内存数',
'taskManagerMemory':'taskManager内存数',
'Complement range': '补数范围',
'Http Url':'请求地址',
'Http Method':'请求类型',
'Http Parameters':'请求参数',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册