Forum Stats

  • 3,816,065 Users
  • 2,259,136 Discussions
  • 7,893,381 Comments

Discussions

JFileChooser initialization very slow in Java 1.8

Pooja Reddy
Pooja Reddy Member Posts: 1
edited Dec 4, 2017 3:32AM in Swing

Hi,

Our application is in Java 1.8.0_121. We are using "JFileChooser"  and see that its ridiculously slow always (not just first time)

Below is the thread dump stack trace which tells what was event thread doing then

"AWT-EventQueue-2" prio=0 tid=30 nid=0 waiting on condition [on lock [email protected]]

    java.lang.Thread.State: WAITING (parking)

    at sun.misc.Unsafe.park(Native Method)

    at java.util.concurrent.locks.LockSupport.park(Unknown Source)

    at java.util.concurrent.FutureTask.awaitDone(Unknown Source)

    at java.util.concurrent.FutureTask.get(Unknown Source)

    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker.invoke(Unknown Source)

    at sun.awt.shell.ShellFolder.invoke(Unknown Source)

    at sun.awt.shell.Win32ShellFolder2.listFiles(Unknown Source)

    at sun.awt.shell.ShellFolder.listFiles(Unknown Source)

    at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)

    at sun.awt.shell.ShellFolder.get(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.addItem(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxModel.access$800(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI.doDirectoryChanged(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI.access$1100(Unknown Source)

    at javax.swing.plaf.metal.MetalFileChooserUI$5.propertyChange(Unknown Source)

    at java.beans.PropertyChangeSupport.fire(Unknown Source)

    at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)

    at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)

    at java.awt.Component.firePropertyChange(Unknown Source)

    at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)

    at javax.swing.JFileChooser.<init>(Unknown Source)

  at javax.swing.JFileChooser.<init>(Unknown Source

We see the same stacktrace everytime this slowness is observed.

Can you guys please help in identified what is the problem here ? I dont see any huge files in the default directory which is "My Documents"

Any code changes needed to be done to fix this ?

Thanks

This discussion has been closed.