[
https://issues.apache.org/jira/browse/VFS-839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17742200#comment-17742200
]
Gary D. Gregory commented on VFS-839:
-------------------------------------
Google translate says:
When all the cached files are cleared, the SoftRefReleaseThread thread will be
automatically stopped, the fileSystemCache will be cleared when the thread is
stopped, the softRefReleaseThread variable will be set to null, and the
original thread will be interrupted, and the thread is safe; but during the
process of stopping the SoftRefReleaseThread thread, there may be new The
thread fetches the file from the cache, in
In the getOrCreateFilesystemCache method, when the fileSystemCache is empty, a
new SoftRefReleaseThread thread will be started, but the method of interrupting
the thread has not yet set the softRefReleaseThread variable to null, the
thread cannot be started, and the fileSystem is used as the key in the
fileSystemCache variable, which is not thread-safe ;cause the
SoftRefReleaseThread thread can no longer be automatically started;
The overall execution steps are shown in the figure below:
> SoftRefReleaseThread线程close后,不能再次自动启动
> -------------------------------------
>
> Key: VFS-839
> URL: https://issues.apache.org/jira/browse/VFS-839
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.7.0
> Environment: CentOS 7.4
> JDK 1.8
> Reporter: fanshu
> Priority: Major
> Attachments: image-2023-07-11-10-07-44-143.png
>
>
> 当缓存的文件被全部清理后,会自动停止SoftRefReleaseThread线程,停止线程会清空fileSystemCache,softRefReleaseThread变量设为null,再将原来的线程中断,且线程安全;但是在停止SoftRefReleaseThread线程过程中,可能有新的线程从缓存获取文件,在
> getOrCreateFilesystemCache方法中,当fileSystemCache为空时,会去启动新的SoftRefReleaseThread线程,但中断线程的方法还未将softRefReleaseThread变量设为null,线程不能被启动,且将fileSystem作为key放到fileSystemCache变量,非线程安全;导致SoftRefReleaseThread线程再也不能自动启动;
> 整体执行步骤见下图:
> !image-2023-07-11-10-07-44-143.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)