Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
slm-fileview
Commits
a07c9628
Commit
a07c9628
authored
Nov 29, 2019
by
陈精华
Committed by
kl
Nov 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化:Office组件运行状态检测
parent
09b6964c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
pom.xml
jodconverter-web/pom.xml
+5
-0
ConverterUtils.java
...ter-web/src/main/java/cn/keking/utils/ConverterUtils.java
+5
-4
No files found.
jodconverter-web/pom.xml
View file @
a07c9628
...
...
@@ -60,6 +60,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.7
</version>
</dependency>
<!-- REDISSON -->
<dependency>
<groupId>
org.redisson
</groupId>
...
...
jodconverter-web/src/main/java/cn/keking/utils/ConverterUtils.java
View file @
a07c9628
...
...
@@ -2,6 +2,7 @@ package cn.keking.utils;
import
com.sun.star.document.UpdateDocMode
;
import
cn.keking.extend.ControlDocumentFormatRegistry
;
import
org.apache.commons.lang3.StringUtils
;
import
org.artofsolving.jodconverter.OfficeDocumentConverter
;
import
org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration
;
import
org.artofsolving.jodconverter.office.OfficeManager
;
...
...
@@ -97,8 +98,8 @@ public class ConverterUtils {
}
else
{
flag
=
false
;
}
}
else
{
Process
p
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"sh"
,
"-c"
,
"ps -ef | grep "
+
processName
});
}
else
{
Process
p
=
Runtime
.
getRuntime
().
exec
(
new
String
[]{
"sh"
,
"-c"
,
"ps -ef | grep "
+
processName
});
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
InputStream
os
=
p
.
getInputStream
();
byte
b
[]
=
new
byte
[
256
];
...
...
@@ -106,8 +107,8 @@ public class ConverterUtils {
baos
.
write
(
b
);
}
String
s
=
baos
.
toString
();
if
(
s
.
indexOf
(
processName
)
>=
0
)
{
String
[]
cmd
={
"sh"
,
"-c"
,
"kill
all -9 "
+
processName
};
if
(
StringUtils
.
ordinalIndexOf
(
s
,
processName
,
3
)
>
0
)
{
String
[]
cmd
={
"sh"
,
"-c"
,
"kill
-15 `ps -ef|grep "
+
processName
+
"|awk 'NR==1{print $2}'`"
};
Runtime
.
getRuntime
().
exec
(
cmd
);
flag
=
true
;
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment