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 23087 - Invoke actions in RP thread
Summary: Invoke actions in RP thread
Status: CLOSED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Marian Petras
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2002-05-03 11:08 UTC by Jaroslav Tulach
Modified: 2003-06-30 17:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2002-05-03 11:08:58 UTC
In build 200204180100 I have noticed too much
activite in Automount request processor. I believe
that it is caused by JavaLineBreakpoint listening
on changes in filesystems. These changes do not
need to be 
done immediatelly, so please use
RequestProcessor.getDefault () to invoke them.


"Automount" daemon prio=1 tid=0x0x88de118
nid=0x42d9 waiting on monitor [53484000..5348488c]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:426)
        at
org.openide.util.Task.waitFinished(Task.java:86)
        - locked <0x4433b728> (a
org.netbeans.modules.java.parser.ParsingSupport$Processor$T)
        at
org.netbeans.modules.java.parser.SourceImplProxy.findModelDelegate(SourceImplProxy.java:292)
        at
org.netbeans.modules.java.parser.SourceImplProxy.safeFindModelDelegate(SourceImplProxy.java:304)
        at
org.netbeans.modules.java.parser.SourceImplProxy.getClasses(SourceImplProxy.java:149)
        at
org.openide.src.SourceElement.getClasses(SourceElement.java:227)
        at
org.openide.src.ClassElement.testFileForName(ClassElement.java:1048)
        at
org.openide.src.ClassElement.forName(ClassElement.java:953)
        at
org.netbeans.modules.debugger.support.util.Utils.getLineSet(Utils.java:453)
        at
org.netbeans.modules.debugger.support.util.Utils.getLine(Utils.java:437)
        at
org.netbeans.modules.debugger.support.java.JavaLineBreakpointEvent.updateLine(JavaLineBreakpointEvent.java:417)
        - locked <0x44bd8208> (a
org.netbeans.modules.debugger.jpda.LineBreakpoint)
        at
org.netbeans.modules.debugger.support.java.JavaLineBreakpointEvent$LineBreakpointUpdater.fileSystemAdded(JavaLineBreakpointEvent.java:596)
        - locked <0x44bd9708> (a
org.netbeans.modules.debugger.support.java.JavaLineBreakpointEvent$LineBreakpointUpdater)
        at
org.openide.filesystems.Repository.fireFileSystem(Repository.java:473)
        at
org.openide.filesystems.Repository.addFileSystem(Repository.java:184)
        at
org.netbeans.core.AutomountSupport.cycleFileSystems(AutomountSupport.java:605)
        at
org.netbeans.core.AutomountSupport.updateFileSystems(AutomountSupport.java:508)
        - locked <0x44931fa8> (a
org.openide.filesystems.Repository)
        at
org.netbeans.core.AutomountSupport.taskFinished(AutomountSupport.java:155)
        at
org.openide.util.Task.notifyFinished(Task.java:123)
        at
org.openide.loaders.FolderInstance.defaultProcessObjects(FolderInstance.java:586)
        at
org.openide.loaders.FolderInstance.access$100(FolderInstance.java:45)
        at
org.openide.loaders.FolderInstance$2.run(FolderInstance.java:456)
        at org.openide.util.Task.run(Task.java:138)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:599)
Comment 1 Jaroslav Tulach 2002-05-03 11:23:54 UTC
You can also merge multiple checks into one done later, because during
project switch the number of adds and removes can be very high.
Comment 2 Marian Petras 2002-05-10 11:45:51 UTC
Fixed in the main trunk.
Comment 3 Marian Petras 2002-05-10 11:48:14 UTC
A separate instance of RequestProcessor is used so that tasks
(breakpoint updates) are serialized.
Comment 4 Jaroslav Tulach 2002-05-13 07:10:25 UTC
Fine, but tell me how I am supposed to verify this? Can you tell me
which classes and which version this has been fixed in?
Comment 5 Marian Petras 2002-05-13 11:18:51 UTC
I tested the effect of the change by printing debugging messages
(removed before commit).

You can verify it by looking over the changes I have made and reading
my comments.

Changes:

cvs diff -r 1.7 -r 1.9
debuggercore/src/org/netbeans/modules/debugger/support/java/BreakpointUpdater.java
cvs diff -r 1.22 -r 1.23
debuggercore/src/org/netbeans/modules/debugger/support/java/JavaLineBreakpointEvent.java

Comments:

In the old version, each BreakpointUpdater was listening on a
repository and updating the breakpoint as soon as some filesytems was
mounted or unmounted.

In the new version, there is just one repository listener. If a
BreakpointUpdater wants to be notified of filesystem un/mounts, it
must register to the repository listener (class
LazyRepositoryListener). LazyRepositoryListener holds a single
instance of RequestProcessor (having throughput 1). When a filesystem
is un/mounted, the LazyRepositoryListener remembers that the
filesystem was un/mounted and schedules a task (with a 500ms delay).
The task notifies all registered BreakpointUpdaters of filesystems
that were mounted/unmounted since the previous run of the task.
  Thus, if several filesystems are mounted and/or unmounted quickly
(with short delays between un/mounts), each breakpoint is updated only
once.

I have tested the new behaviour and obtained the following results:
- during startup:
  Each (existing) breakpoint is updated twice (there is a relatively
  long delay between two series of un/mounts).
- during project switch:
  Each breakpoint is updated just once.
Comment 6 Jaroslav Tulach 2002-05-13 14:30:16 UTC
Ok, this is the right way to fix the problem. But please check
following code:

public final void fileSystemAdded(RepositoryEvent e) {              
  if (addedFS == null) {
    addedFS = new ArrayList(10);               
  }
  addedFS.add(e.getFileSystem());
  synchronized (registeredUpdaters) {

I believe that this is not synchronized correctly, because you can
create addedFS twice (the same for removeFS).

Otherwise seems ok.
Comment 7 Marian Petras 2002-05-13 15:19:56 UTC
Fixed - manipulation with lists 'addedFS' and 'removedFS' is enclosed
in blocks 'synchronized (this)':

cvs diff -r 1.9 -r 1.10
debuggercore/src/org/netbeans/modules/debugger/support/java/BreakpointUpdater.java
Comment 8 Quality Engineering 2003-06-30 17:30:00 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.