[ https://issues.apache.org/jira/browse/PIVOT-878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484662#comment-13484662 ]
Ronald Thomas commented on PIVOT-878: ------------------------------------- To work around this until the release with the fix is available, I created a wrapper class that holds a reference to the FileBrowserSheet instance and initializes it (calls the constructor) in a separate thread. Any attempt to call open() via the wrapper joins the initialization thread if it is still active. However, one side-effect of holding onto a pre-initialized instance of FileBrowserSheet is that if any drives (file-roots) are added or removed after constructing the FileBrowserSheet object, the drive (file-root) list never updates to reflect the change. I can probably work around that too for now but it would be better if the FileBrowserSheet itself had a background/daemon thread to monitor (i.e. poll) for changes in the drive (file-root) list. That might need to be another Jira ticket, but based on the last comment about "loading the drive list in the background" it might need to be considered in the final solution of this issue too. If it is to be the Pivot idiom to always construct a brand new FileBrowserSheet whenever one is needed (instead of retaining a reference to a FileBrowserSheet instance that could be displayed more than once), that should probably be made clearer in the tutorial/demo code. > Show FileBrowserSheet while Initializing > ---------------------------------------- > > Key: PIVOT-878 > URL: https://issues.apache.org/jira/browse/PIVOT-878 > Project: Pivot > Issue Type: Improvement > Components: wtk-terra > Affects Versions: 2.0.2 > Environment: All (Mostly Windows) > Reporter: Ronald Thomas > Assignee: Roger Whitcomb > Priority: Minor > Labels: Browsing, File, FileBrowserSheet, performance, > responsiveness, wtk, wtk-terra > Fix For: 2.1, 2.0.3 > > Attachments: PIVOT-878_example_src.zip, > tptp_profiler_exec_call_tree_screenshot.png > > > If the list of file roots returned by > http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html#listRoots() > includes more than a few network drives (primarily on windows where each > mapped drive is its own "file system root"), or if the initial path on the > FileBrowserSheet maps to a device that takes a while to "spin up", the > FileBrowserSheet may not appear on the screen for several seconds making the > Pivot app appear unresponsive. It would help if there were some indication > of activity immediately after the call to the FileBrowserSheet.open() method. > The FileBrowserSheet could be displayed in a "loading" mode and then > switched to its normal display mode once the potentially long-running > initialization has completed. > In this case, the long running code is around line 936-947 of the 2.0.2 > release source file at > wtk-terra\src\org\apache\pivot\wtk\skin\terra\TerraFileBrowserSkin.java > Steps to reproduce: > # Create a Pivot application that opens a FileBrowserSheet using a button. > # Map about 6 network drives or connect external hard drives to drive letters > on a machine running windows > # Wait enough time for the power-management "spin down" on some or all of the > mapped or connected drives > # Run the Pivot application and click the button that opens the > FileBrowserSheet > # *Nothing appears to be happening for several seconds* (far too long) while > the JVM collects the results of File.listRoots() to populate the > "driveListButton" listData. > # Finally after several seconds, the FileBrowserSheet appears. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira