[scheduler] 解决采集任务内容更新时调度失效问题,数据库连接失效导致应用异常
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,7 +9,7 @@ micronaut-cli.yml
|
|||||||
.mvn/
|
.mvn/
|
||||||
mvnw
|
mvnw
|
||||||
mvnw.bat
|
mvnw.bat
|
||||||
.log
|
*.log
|
||||||
|
|
||||||
### STS ###
|
### STS ###
|
||||||
.apt_generated
|
.apt_generated
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"id": 87584674384,
|
"id": 87584674384,
|
||||||
"monitorId": 875846754543,
|
"monitorId": 875846754543,
|
||||||
"type": 1,
|
"type": 1,
|
||||||
"value": "80"
|
"value": "8088"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"field": "host",
|
"field": "host",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package com.usthe.manager.support;
|
|||||||
import com.usthe.common.entity.dto.Message;
|
import com.usthe.common.entity.dto.Message;
|
||||||
import com.usthe.manager.support.exception.MonitorDatabaseException;
|
import com.usthe.manager.support.exception.MonitorDatabaseException;
|
||||||
import com.usthe.manager.support.exception.MonitorDetectException;
|
import com.usthe.manager.support.exception.MonitorDetectException;
|
||||||
|
import com.usthe.scheduler.ScheduleException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -134,6 +135,23 @@ public class GlobalExceptionHandler {
|
|||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(message);
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理分发调度器异常问题
|
||||||
|
* @param exception 调度器异常问题
|
||||||
|
* @return response
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(ScheduleException.class)
|
||||||
|
@ResponseBody
|
||||||
|
ResponseEntity<Message<Void>> handleScheduleException(ScheduleException exception) {
|
||||||
|
String errorMessage = "scheduler warning";
|
||||||
|
if (exception != null) {
|
||||||
|
errorMessage = exception.getMessage();
|
||||||
|
}
|
||||||
|
log.warn("[scheduler warning]-{}", errorMessage);
|
||||||
|
Message<Void> message = Message.<Void>builder().msg(errorMessage).build();
|
||||||
|
return ResponseEntity.status(HttpStatus.CONFLICT).body(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handler the exception thrown for datastore error
|
* handler the exception thrown for datastore error
|
||||||
* @param exception datastore exception
|
* @param exception datastore exception
|
||||||
|
|||||||
Reference in New Issue
Block a user