mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复Tailer文件内容跟随在调用stop后,文件依旧被占用问题
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.exceptions.UtilException;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IORuntimeException;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.io.LineHandler;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
@@ -137,7 +138,11 @@ public class Tailer implements Serializable {
|
||||
* 结束,此方法需在异步模式或
|
||||
*/
|
||||
public void stop(){
|
||||
this.executorService.shutdown();
|
||||
try{
|
||||
this.executorService.shutdown();
|
||||
}finally {
|
||||
IoUtil.close(this.randomAccessFile);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------- Private method start
|
||||
|
Reference in New Issue
Block a user