mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 13:34:09 +08:00
修复Tailer文件内容跟随在调用stop后,文件依旧被占用问题
This commit is contained in:
parent
c3f378207b
commit
ae4d79ebd6
@ -12,6 +12,8 @@
|
||||
* 【core 】 修复FileUtil.rename报NoSuchFileException问题(pr#2894@Github)
|
||||
* 【core 】 修复StrUtil.split切分长度为0时的bug(pr#944@Gitee)
|
||||
* 【core 】 修复ReUtil.delAll方法当 content 仅为空格时的问题(issue#I6GIMT@Gitee)
|
||||
* 【core 】 修复ReUtil.delAll方法当 content 仅为空格时的问题(issue#I6GIMT@Gitee)
|
||||
* 【core 】 修复Tailer文件内容跟随在调用stop后,文件依旧被占用问题(issue#I6GFD2@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user