|
|
@@ -57,7 +57,7 @@ public class JmsListener {
|
|
|
* 每次接收到jms消息后等待的时间(秒)
|
|
|
* @return 开启成功与否的提示信息
|
|
|
*/
|
|
|
- public String start(Long period) {
|
|
|
+ public void start(Long period) {
|
|
|
if(period == null){
|
|
|
period = PERIOD;
|
|
|
}else{
|
|
|
@@ -67,11 +67,8 @@ public class JmsListener {
|
|
|
throw new IllegalArgumentException("period 不合法:" + period);
|
|
|
}
|
|
|
|
|
|
- String message = "";
|
|
|
if (isRunning()) {
|
|
|
- message = "已存在运行的索引实时更新服务";
|
|
|
- logger.warn(message);
|
|
|
- return message;
|
|
|
+ throw new IllegalStateException("已存在运行的索引实时更新服务");
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
@@ -104,16 +101,12 @@ public class JmsListener {
|
|
|
taskService.stop();
|
|
|
}
|
|
|
taskService.start();
|
|
|
- message = "索引实时更新服务成功开启";
|
|
|
- logger.info(message);
|
|
|
} catch (Throwable e) {
|
|
|
- message = "索引实时更新服务开启失败";
|
|
|
- logger.error(message, e);
|
|
|
if (taskInformation != null) {
|
|
|
taskInformation = null;
|
|
|
}
|
|
|
+ throw new IllegalStateException("开启失败", e);
|
|
|
}
|
|
|
- return message;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -121,11 +114,9 @@ public class JmsListener {
|
|
|
*
|
|
|
* @return 关闭成功与否的提示信息
|
|
|
*/
|
|
|
- public String stop() {
|
|
|
- String message = "";
|
|
|
+ public void stop() {
|
|
|
if (!isRunning()) {
|
|
|
- message = "索引实时更新服务未开启或已关闭";
|
|
|
- logger.warn(message);
|
|
|
+ throw new IllegalStateException("索引实时更新服务未开启或已关闭");
|
|
|
} else {
|
|
|
taskService.remove(taskInformation.getCode());
|
|
|
taskInformation = null;
|
|
|
@@ -133,9 +124,7 @@ public class JmsListener {
|
|
|
taskService.stop();
|
|
|
}
|
|
|
taskService.start();
|
|
|
- message = "索引实时更新服务成功关闭";
|
|
|
}
|
|
|
- return message;
|
|
|
}
|
|
|
|
|
|
/**
|