【功能完善】IoT: 增强插件启动和停止逻辑,添加异常处理,更新错误码,优化配置文件
This commit is contained in:
@@ -191,13 +191,23 @@ public class IotPluginInstanceServiceImpl implements IotPluginInstanceService {
|
||||
// 启动插件
|
||||
if (status.equals(IotPluginStatusEnum.RUNNING.getStatus())
|
||||
&& plugin.getPluginState() != PluginState.STARTED) {
|
||||
pluginManager.startPlugin(pluginKey);
|
||||
try {
|
||||
pluginManager.startPlugin(pluginKey);
|
||||
} catch (Exception e) {
|
||||
log.error("[updatePluginStatus][启动插件({}) 失败]", pluginKey, e);
|
||||
throw exception(ErrorCodeConstants.PLUGIN_START_FAILED, e);
|
||||
}
|
||||
log.info("已启动插件: {}", pluginKey);
|
||||
}
|
||||
// 停止插件
|
||||
else if (status.equals(IotPluginStatusEnum.STOPPED.getStatus())
|
||||
&& plugin.getPluginState() == PluginState.STARTED) {
|
||||
pluginManager.stopPlugin(pluginKey);
|
||||
try {
|
||||
pluginManager.stopPlugin(pluginKey);
|
||||
} catch (Exception e) {
|
||||
log.error("[updatePluginStatus][停止插件({}) 失败]", pluginKey, e);
|
||||
throw exception(ErrorCodeConstants.PLUGIN_STOP_FAILED, e);
|
||||
}
|
||||
log.info("已停止插件: {}", pluginKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user