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.
Summary: | Improve threading model | ||
---|---|---|---|
Product: | debugger | Reporter: | Martin Entlicher <mentlicher> |
Component: | Java | Assignee: | Martin Entlicher <mentlicher> |
Status: | CLOSED FIXED | ||
Severity: | blocker | Keywords: | API, API_REVIEW_FAST |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: | The proposed API change. |
Description
Martin Entlicher
2009-01-06 16:58:46 UTC
The solution is to introduce: ReadWriteLock JPDADebuggerImpl.accessLock field and ReadWriteLock JPDAThreadImpl.accessLock field. Acquisition of JPDAThreadImpl.accessLock.readLock() or JPDAThreadImpl.accessLock.writeLock() will also acquire JPDADebuggerImpl.accessLock.readLock(). That assures that the VM global state can not be changed while invoking operations on a thread. Retrieval of thread state (like call stack, monitors, local variables, etc.) is performed under JPDAThreadImpl.accessLock.readLock(). Modification of thread state (like suspend/resume, method invocation) is performed under JPDAThreadImpl.accessLock.writeLock(). Retrieval of VM global state is performed under JPDADebuggerImpl.accessLock.readLock(). Modification of VM global state is performed under JPDADebuggerImpl.accessLock.writeLock(). Since we need to retrieve the thread state information from the debugger.jpda.ui module as well, we need to put the JPDAThreadImpl.accessLock.readLock() into the APIs in order to be able to synchronize the access on it. Created attachment 75509 [details]
The proposed API change.
Please review this simple API change that helps with synchronization. Instead of synchronize(JPDAThread instance) client code will use JPDAThread.getReadAccessLock().lock(). Thanks, I'm going to commit this simple change tomorrow COB. The synchronized constructs are replaced with ReadWriteLock in changeset: 113877:7571a0a187b9 http://hg.netbeans.org/main/rev/7571a0a187b9 Also, in order to improve the threads management and prevent from threads proliferation, JavaEngineProvider creates an RP of throughoutput 5, which is used for JDI communication. Changeset: 113878:18aae736efdb http://hg.netbeans.org/main/rev/18aae736efdb To assure that we do not acquire the communication lock in AWT thread, assertion was added in changeset: 113880:b286f96180aa http://hg.netbeans.org/main/rev/b286f96180aa Integrated into 'main-golden', will be available in build *200901160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/7571a0a187b9 User: mentlicher@netbeans.org Log: #156368 - Improve the threading model. ReadWriteLock is introduced to synchronize the communication with the debuggee instead of the "synchronize" keyword. Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier. |