Max:

The big bottleneck in that stacktrace is obviously the following lines:


       ArchiveModuleFactory(JBossModuleFactory).cacheModules() line: 86
       ArchiveModuleFactory(JBossModuleFactory).getModules() line: 66
       ModuleFactory.getModules() line: 133


The problem here is that no matter what I do, I cant get "cacheModules" to be called more than once in any session. That method should *only* be called once, at the very startup of the model, and I admit it is a decently long-running method which goes through the entire workspace looking for jars.

(I know what you're going to say... why even go through and LOOK for jars all at once? Why not just respond with a module upon request... and the reason here is the way I understand WTP to work... the factory has a method getModules which obviously gets called at random times, so I kind of need to have all possible modules on hand all the time. But a module, the way I use it, is basically just a wrapper. Currently all I do is open the file and if it's a jar, I say poof... you're a module. )

Anyway... as I said before... cacheModules is only called upon startup of the factory. I've tried deleting projects, adding projects, pasting in multiple jars at once (which would trigger a whole bunch of resource change events etc), and no matter what I do, I *cannot* get cacheModules to be called a second time.


Some more details:

cacheModules is only called if a variable named pathToModule (a hashmap) is null. This is a field inside my ModuleFactoryDelegate (JBossModuleFactory), which is an extension point who's constructor is only called once by the wtp structure, so there's no question here about multiple factory instances being created without my knowledge, each trying to create their own cache.

The variable itself is protected, and there's absolutely no point in my code where it is set to null. It starts as null, however once the cache is filled, it is never emptied or reset. If you dig into it you'll actually find there's two caches. My own cache in JBossModuleFactory, and the wtp cache in ModuleFactory. I do reset the wtp cache, but then it just asks me for a list of modules again, and I send it my current local cache.  I *have* gotten that scenerio to occur, but I've not once been able to get cacheModules to be called more than once a session.

Marshall suggests you send me your workspace and a list of repeatable steps I could use.

- Rob



On 7/20/06, Max Rydahl Andersen < max.andersen@jboss.com> wrote:

In a decent sized workspace (basically just hibernate labs) I get to wait
many times :(

The stacktrace are mostly like this:

Is this "just" WTP having fun (i see .getModules() calls) or are we doing
something bad ?

Thread [main] (Suspended)
        ZipFile.open (String, int, long) line: not available [native method]
        JarFile(ZipFile).<init>(File, int) line: 203
        JarFile.<init>(File, boolean, int) line: 132
        JarFile.<init>(File) line: 97
        ArchiveModuleFactory.supports(IResource) line: 65
        ArchiveModuleFactory.acceptAddition(IResource) line: 33
        JBossModuleFactory$1.visit(IResource) line: 88
        Resource$2.visit(IResourceProxy) line: 105
        Resource$1.visitElement(ElementTree, IPathRequestor, Object) line: 57
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 81
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration (DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.doIteration (DataTreeNode, IElementContentVisitor)
line: 85
        ElementTreeIterator.iterate(IElementContentVisitor) line: 126
        Project(Resource).accept(IResourceProxyVisitor, int) line: 67
        Project(Resource).accept(IResourceVisitor, int, int) line: 103
        Project(Resource).accept(IResourceVisitor) line: 87
        ArchiveModuleFactory(JBossModuleFactory).cacheModules() line: 86
        ArchiveModuleFactory(JBossModuleFactory).getModules() line: 66
         ModuleFactory.getModules() line: 133
        ServerUtil.getModules() line: 247
        ServerUtil.getModule(IProject) line: 47
        ResourceManager.publishHandleProjectChange(IResourceDelta) line: 916
        ResourceManager$1.visit(IResourceDelta) line: 110
        ResourceDelta.accept(IResourceDeltaVisitor, int) line: 67
        ResourceDelta.accept(IResourceDeltaVisitor, int) line: 76
        ResourceDelta.accept(IResourceDeltaVisitor) line: 48
        ResourceManager$ServerResourceChangeListener.resourceChanged(IResourceChangeEvent)
line: 104
        NotificationManager$2.run() line: 280
        SafeRunner.run(ISafeRunnable) line: 37
        NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[],
IResourceChangeEvent, boolean) line: 274
        NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent,
boolean) line: 148
        Workspace.broadcastPostChange() line: 256
        Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line:
958
        Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor)
line: 1746
        WorkspaceModifyDelegatingOperation(WorkspaceModifyOperation).run(IProgressMonitor)
line: 113
         WorkspaceOperationRunner.run(boolean, boolean, IRunnableWithProgress,
ISchedulingRule) line: 73
        WorkspaceOperationRunner.run(boolean, boolean, IRunnableWithProgress)
line: 63
        CompilationUnitDocumentProvider(TextFileDocumentProvider).executeOperation(TextFileDocumentProvider$DocumentProviderOperation,
IProgressMonitor) line: 460
        CompilationUnitDocumentProvider(TextFileDocumentProvider).saveDocument(IProgressMonitor,
Object, IDocument, boolean) line: 744
        CompilationUnitEditor(AbstractTextEditor).performSave(boolean,
IProgressMonitor) line: 3796
        CompilationUnitEditor.performSave(boolean, IProgressMonitor) line: 1343
        CompilationUnitEditor.doSave(IProgressMonitor) line: 1396
        DefaultSaveable.doSave(IProgressMonitor) line: 50
        EditorManager$6.run(IProgressMonitor) line: 1247
        SaveableHelper$4.run(IProgressMonitor) line: 252
        ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor)
line: 369
        ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor,
Display) line: 313
        ApplicationWindow$1.run() line: 763
        BusyIndicator.showWhile(Display, Runnable) line: 67
        WorkbenchWindow(ApplicationWindow).run(boolean, boolean,
IRunnableWithProgress) line: 760
        WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 2283
        SaveableHelper.runProgressMonitorOperation(String, IRunnableWithProgress,
IWorkbenchWindow) line: 258
        EditorManager.saveAll(List, boolean, boolean, IWorkbenchWindow) line:
1260
        EditorManager.saveAll(boolean, boolean) line: 1055
        WorkbenchPage.saveAllEditors(boolean) line: 2968
         SaveAllAction.run() line: 132
        SaveAllAction(Action).runWithEvent(Event) line: 499
        ActionHandler.execute(ExecutionEvent) line: 119
        Command.executeWithChecks(ExecutionEvent) line: 461
         ParameterizedCommand.executeWithChecks(Object, Object) line: 424
        HandlerService.executeCommand(ParameterizedCommand, Event) line: 160
        WorkbenchKeyboard.executeCommand(Binding, Event) line: 466
         WorkbenchKeyboard.press(List, Event) line: 799
        WorkbenchKeyboard.processKeyEvent(List, Event) line: 846
        WorkbenchKeyboard.filterKeySequenceBindings(Event) line: 564
        WorkbenchKeyboard.access$3 (WorkbenchKeyboard, Event) line: 506
        WorkbenchKeyboard$KeyDownFilter.handleEvent(Event) line: 122
        EventTable.sendEvent(Event) line: 66
        Display.filterEvent(Event) line: 982
        StyledText(Widget).sendEvent(Event) line: 927
        StyledText(Widget).sendEvent(int, Event, boolean) line: 952
        StyledText(Widget).sendEvent(int, Event) line: 937
        StyledText(Widget).sendKeyEvent(int, int, int, int, Event) line: 965
        StyledText(Widget).sendKeyEvent(int, int, int, int) line: 961
        StyledText(Widget).wmChar(int, int, int) line: 1275
        StyledText(Control).WM_CHAR(int, int) line: 3346
        StyledText(Control).windowProc(int, int, int, int) line: 3246
        Display.windowProc (int, int, int, int) line: 4025
        OS.DispatchMessageW(MSG) line: not available [native method]
        OS.DispatchMessage(MSG) line: 1923
        Display.readAndDispatch() line: 2966
        Workbench.runEventLoop (Window$IExceptionHandler, Display) line: 1914
        Workbench.runUI() line: 1878
        Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 419
        PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
        IDEApplication.run(Object) line: 95
        PlatformActivator$1.run(Object) line: 78
        EclipseAppLauncher.runApplication(Object) line: 92
        EclipseAppLauncher.start(Object) line: 68
         EclipseStarter.run(Object) line: 400
        EclipseStarter.run(String[], Runnable) line: 177
        NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
        NativeMethodAccessorImpl.invoke (Object, Object[]) line: 39
        DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
        Method.invoke(Object, Object...) line: 585
        Main.invokeFramework(String[], URL[]) line: 336
         Main.basicRun(String[]) line: 280
        Main.run(String[]) line: 977
        Main.main(String[]) line: 952


--
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
max@hibernate.org
http://hibernate.org

JBoss Inc
max.andersen@jboss.com
_______________________________________________
jbosside-dev mailing list
jbosside-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosside-dev