新增office转换 超时属性功能

新增office转换 超时属性功能

Signed-off-by: 高雄 <admin@cxcp.com>
This commit is contained in:
高雄
2024-01-02 03:09:03 +00:00
committed by Gitee
parent 4852b1479b
commit 20a5c1b494

View File

@ -43,6 +43,12 @@ public class OfficePluginManager {
@Value("${office.plugin.task.timeout:5m}") @Value("${office.plugin.task.timeout:5m}")
private String timeOut; private String timeOut;
@Value("${office.plugin.task.taskexecutiontimeout:5m}")
private String taskExecutionTimeout;
@Value("${office.plugin.task.maxtasksperprocess:5}")
private int maxTasksPerProcess;
/** /**
* 启动Office组件进程 * 启动Office组件进程
*/ */
@ -60,10 +66,13 @@ public class OfficePluginManager {
String[] portsString = serverPorts.split(","); String[] portsString = serverPorts.split(",");
int[] ports = Arrays.stream(portsString).mapToInt(Integer::parseInt).toArray(); int[] ports = Arrays.stream(portsString).mapToInt(Integer::parseInt).toArray();
long timeout = DurationStyle.detectAndParse(timeOut).toMillis(); long timeout = DurationStyle.detectAndParse(timeOut).toMillis();
long taskexecutiontimeout = DurationStyle.detectAndParse(taskExecutionTimeout).toMillis();
officeManager = LocalOfficeManager.builder() officeManager = LocalOfficeManager.builder()
.officeHome(officeHome) .officeHome(officeHome)
.portNumbers(ports) .portNumbers(ports)
.processTimeout(timeout) .processTimeout(timeout)
.maxTasksPerProcess(maxTasksPerProcess)
.taskExecutionTimeout(taskexecutiontimeout)
.build(); .build();
officeManager.start(); officeManager.start();
InstalledOfficeManagerHolder.setInstance(officeManager); InstalledOfficeManagerHolder.setInstance(officeManager);