JDK-8327234 : In File Loading Thread filechooser.isTraversable is run on COM thread
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows
  • Submitted: 2024-03-04
  • Updated: 2024-03-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
JFileChooser uses a background thread, BasicDirectoryModel.FilesLoader, to list the files and update the UI.

To determine whether a file is traversable, the thread calls filechooser.isTraversable(file) which is executed on the COM thread on Windows. https://github.com/openjdk/jdk/blob/0583f7357480c0500daa82f490b2fcc05f2fb65a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java#L318-L320

That is for each and every file in list, there's a context switch between threads. This is very inefficient.

Before the fix for JDK-6713352, this piece of code was executed inside ShellFolder.invoke.
Comments
It is possible that there's nothing we can do to avoid the deadlock from JDK-6713352 and move the code into the COM thread. To improve performance, individual files can be combined into batches to get their isTraversable() status.
04-03-2024