This commit is contained in:
parent
125907517a
commit
7e9a104ca5
|
|
@ -15,10 +15,6 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
|
@ -50,7 +46,6 @@ public class TailfLogService {
|
|||
if ("log".equals(tp)) {
|
||||
// 不存在则创建
|
||||
String filePath = "/data/workspace/myshixun_" + msg.getString("data") + "/user.out";
|
||||
// String filePath = "/tmp/myshixun_" + msg.getString("data") + "/user.out";
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
try {
|
||||
|
|
@ -97,7 +92,6 @@ public class TailfLogService {
|
|||
* @param session session
|
||||
*/
|
||||
public void close(WebSocketSession session) {
|
||||
|
||||
if (session != null) {
|
||||
try {
|
||||
Process process = sessionProcessMap.get(session.getId());
|
||||
|
|
@ -124,11 +118,13 @@ public class TailfLogService {
|
|||
boolean result = false;
|
||||
try {
|
||||
session.sendMessage(new TextMessage(Base64Util.encodeBytes(buffer)));
|
||||
Thread.sleep(100);
|
||||
result = true;
|
||||
} catch (IllegalStateException e) {
|
||||
logger.error("tailf连接断开, session: {}", session.getId(), e);
|
||||
} catch (IOException e) {
|
||||
logger.error("读取tailf输出异常, session: {}", session.getId(), e);
|
||||
} catch (InterruptedException ignore) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue