This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61171

Summary: Responsiveness problem during adding new NetBeans platform
Product: apisupport Reporter: pzajac <pzajac>
Component: ProjectAssignee: Martin Krauskopf <mkrauskopf>
Status: VERIFIED FIXED    
Severity: blocker CC: issues, jglick, jrojcek
Priority: P3 Keywords: PERFORMANCE, UI
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: blocked AWT-EVENT-QUEUE
right thread dump

Description pzajac 2005-07-20 13:41:26 UTC
Steps to reproduction:
1) Show NetBeans Platfrom dialog
2) Click to add New platform button
3) Select a platform folder (the folder is not in system disk cache)
4) Click to finish

It takes few seconds on my system. The action blocks in AWT quee. It is better 
to use RequestProcessor and show progressbar.
Comment 1 Martin Krauskopf 2005-08-08 09:57:54 UTC
Yes. We shouldn't block AWT queue. Probably a modal dialog with progress bar
with "Loading NetBeans Platform's metadata" message or something similar? I'll
go that way if anybody (HIE, Jesse, ...) doesn't have other opinion (e.g. some
standard NB approach I've missed)
Comment 2 Jesse Glick 2005-08-08 17:34:53 UTC
I think you can disable both Next and Finish buttons while doing computation,
rather than showing a modal progress dialog on top of a wizard, which is sort of
ugly. I am sure there is some example elsewhere, but can't remember where.

By the way, what exactly is so slow that it needs a progress dialog? AFAIK all
the wizard needs to do is check for the platform's display name, which ought to
be pretty fast since it just needs to open a couple of JARs and look for some
bundles. Reporter, any thread dumps or profiler results?
Comment 3 pzajac 2005-08-09 08:31:56 UTC
Created attachment 23587 [details]
blocked AWT-EVENT-QUEUE
Comment 4 pzajac 2005-08-09 09:03:09 UTC
I attached AWT-EVENT-QUEUE dump. 

The time is spent in 
ModuleList.createModuleListFromBinaries()
There are opened jars of netbeans modules. It takes a lot of time. 

Jesse, do you plan to implement cache for nbplatform? IHMO it is useless to open
all the jars of platform everytime the platchorm is touched. 

For example te cache can contain these informations:
1) the absolute path in filesystem to platform (key)
2) list of all jars in platform
For a jar should be cached these informations:
-location and name in platfrom 
-timestamp and size 
-manifest and layer xml
Comment 5 Martin Krauskopf 2005-08-09 11:13:54 UTC
Isn't this thread dump intended rather for the issue 59550? Attaching threaddump
you probably meant.
Comment 6 Martin Krauskopf 2005-08-09 11:15:02 UTC
Created attachment 23599 [details]
right thread dump
Comment 7 Jesse Glick 2005-08-09 17:27:55 UTC
Ah. In NbPCM.setPlatform, in place of

moduleList.setModel(new ComponentFactory.ModuleEntryListModel(plaf.getModules()));

just use e.g.

moduleList.setModel(new DefaultListModel(new Object[] {"Please wait..."});
RequestProcessor.getDefault().post(new Runnable() {
    public void run() {
        final ModuleEntry[] modules = plaf.getModules();
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                moduleList.setModel(new
ComponentFactory.ModuleEntryListModel(modules));
            }
        });
    }
});

I doubt a progress bar is really needed for this; it's only a displayed list,
analogous to the "Required Projects" list in the Open Project dialog.
Comment 8 Martin Krauskopf 2005-08-10 09:02:21 UTC
Thanks. Fixed.

Checking in ui/platform/NbPlatformCustomizerModules.java; 1.2 --> 1.3
Comment 9 pzajac 2005-09-01 16:18:41 UTC
v