|
@@ -12,8 +12,7 @@ import org.springframework.cloud.client.discovery.DiscoveryClient;
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
+import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
|
import cn.com.qmth.examcloud.task.dao.ScheduleJobRepo;
|
|
|
import cn.com.qmth.examcloud.task.dao.entity.ScheduleJobEntity;
|
|
|
import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
|
|
@@ -31,8 +30,6 @@ import cn.com.qmth.examcloud.web.task.ScheduleJob;
|
|
|
@Order(100)
|
|
|
public class JobsStartup implements ApplicationRunner {
|
|
|
|
|
|
- private static ExamCloudLog log = ExamCloudLogFactory.getLog(JobsStartup.class);
|
|
|
-
|
|
|
@Autowired
|
|
|
private ScheduleJobRepo scheduleJobEntityRepo;
|
|
|
|
|
@@ -48,8 +45,7 @@ public class JobsStartup implements ApplicationRunner {
|
|
|
if (StringUtils.isNotBlank(appName)) {
|
|
|
List<ServiceInstance> instances = discoveryClient.getInstances(appName);
|
|
|
if (!instances.isEmpty()) {
|
|
|
- log.error("不允许多实例启动");
|
|
|
- System.exit(-1);
|
|
|
+ throw new ExamCloudRuntimeException("multiple task instance is not allowed!");
|
|
|
}
|
|
|
}
|
|
|
|