!263 新增office转换 超时属性功能

Merge pull request !263 from 高雄/master
pull/267/MERGE
kailing 2024-02-21 03:10:58 +00:00 committed by Gitee
commit 211df6965f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 14 additions and 1 deletions

View File

@ -27,10 +27,14 @@ spring.freemarker.suffix = .ftl
#openofficeLibreOffice home
#office.home = C:\\Program Files (x86)\\OpenOffice 4
office.home = ${KK_OFFICE_HOME:default}
## office
## office
office.plugin.server.ports = 2001,2002
## office task
office.plugin.task.timeout = 5m
#office0
office.plugin.task.maxtasksperprocess = 200
#
office.plugin.task.taskexecutiontimeout = 5m
# 使 (1-5)
office.pagerange = ${KK_OFFICE_PAGERANGE:false}
# 使 (kkFileView)

View File

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