Index: LoaderPoolNode.java =================================================================== RCS file: /cvs/core/src/org/netbeans/core/LoaderPoolNode.java,v retrieving revision 1.51.14.3 diff -u -r1.51.14.3 LoaderPoolNode.java --- LoaderPoolNode.java 2 Jan 2002 14:33:50 -0000 1.51.14.3 +++ LoaderPoolNode.java 2 Apr 2002 10:36:22 -0000 @@ -78,6 +78,11 @@ /** true if changes in loaders should be notified */ private static boolean installationFinished = false; + + /** if true, we are adding/removing a bunch of loaders; resort later */ + private static boolean updatingBatch = false; + /** see above; true if at least one change */ + private static boolean updatingBatchUsed = false; /** Just workaround, need to pass instance of * the LoaderPoolNodeChildren as two params to superclass @@ -115,6 +120,19 @@ }; } + + public static synchronized void beginUpdates() { + updatingBatch = true; + updatingBatchUsed = false; + } + public static synchronized void endUpdates() { + if (!updatingBatch) throw new IllegalStateException(); + updatingBatch = false; + if (updatingBatchUsed) { + updatingBatchUsed = false; + resort(); + } + } /** Adds new loader when previous and following are specified. * An attempt will be made to (re-)order the loader pool according to specified @@ -148,7 +166,11 @@ installBefores.put (l.getClass ().getName (), s.getInstallBefore ()); installAfters.put (l.getClass ().getName (), s.getInstallAfter ()); - resort (); + if (updatingBatch) { + updatingBatchUsed = true; + } else { + resort (); + } } @@ -546,7 +568,11 @@ installAfters.remove (dl.getClass ().getName ()); dl.removePropertyChangeListener (getNbLoaderPool ()); - resort (); + if (updatingBatch) { + updatingBatchUsed = true; + } else { + resort (); + } return true; } return false; Index: modules/NbInstaller.java =================================================================== RCS file: /cvs/core/src/org/netbeans/core/modules/NbInstaller.java,v retrieving revision 1.20.14.1 diff -u -r1.20.14.1 NbInstaller.java --- modules/NbInstaller.java 9 Jan 2002 11:04:20 -0000 1.20.14.1 +++ modules/NbInstaller.java 2 Apr 2002 10:36:25 -0000 @@ -186,16 +186,21 @@ Iterator it = modules.iterator(); ev.log(Events.PERF_START, "NbInstaller.load - sections"); // NOI18N - while (it.hasNext()) { - Module m = (Module)it.next(); - try { - loadSections(m, true); - } catch (ThreadDeath td) { - throw td; - } catch (Throwable t) { - Util.err.notify(t); + LoaderPoolNode.beginUpdates(); + try { + while (it.hasNext()) { + Module m = (Module)it.next(); + try { + loadSections(m, true); + } catch (ThreadDeath td) { + throw td; + } catch (Throwable t) { + Util.err.notify(t); + } + ev.log(Events.PERF_TICK, "sections for " + m.getCodeName() + " loaded"); // NOI18N } - ev.log(Events.PERF_TICK, "sections for " + m.getCodeName() + " loaded"); // NOI18N + } finally { + LoaderPoolNode.endUpdates(); } ev.log(Events.PERF_END, "NbInstaller.load - sections"); // NOI18N @@ -257,15 +262,20 @@ } } it = modules.iterator(); - while (it.hasNext()) { - Module m = (Module)it.next(); - try { - loadSections(m, false); - } catch (ThreadDeath td) { - throw td; - } catch (Throwable t) { - Util.err.notify(t); + LoaderPoolNode.beginUpdates(); + try { + while (it.hasNext()) { + Module m = (Module)it.next(); + try { + loadSections(m, false); + } catch (ThreadDeath td) { + throw td; + } catch (Throwable t) { + Util.err.notify(t); + } } + } finally { + LoaderPoolNode.endUpdates(); } loadLayers(modules, false); ev.log(Events.FINISH_UNLOAD, modules);