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 123832

Summary: Pluggable Mutex wrapping API to prevent common deadlocks
Product: platform Reporter: Jaroslav Tulach <jtulach>
Component: -- Other --Assignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: blocker CC: mkubec
Priority: P3 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 123899    
Bug Blocks: 91291    
Attachments: Proposed API with a test, however without implementation
New API based on java.util.concurent.Executor
Sample usage of this API in projects to prevent most common deadlocks
Imporved patch that makes sure that only first entrace to the mutex invokes the Executor

Description Jaroslav Tulach 2007-12-11 16:21:22 UTC
A lot of deadlocks is caused by ProjectManager.MUTEX and its habit of doing filesystem operations and refiring them 
while the MUTEX is still in read or write state. This could be avoided if all ProjectManager operations first invoked 
masterfs.runAtomicAction( { MUTEX.xyzAccess( { ... } ) ). This is hard to enforce, as the MUTEX is part of public API 
and everyone can calls its methods. That is why I suggest an API that would allow the creator of a Mutex to wrap these 
calls by custom pre and post code executed outside of the mutex locks.
Comment 1 Jaroslav Tulach 2007-12-11 17:00:22 UTC
Created attachment 54156 [details]
Proposed API with a test, however without implementation
Comment 2 Jaroslav Tulach 2007-12-11 17:05:14 UTC
This API should solve the deadlocks seen after last integration of issue 91291.
Comment 3 Jaroslav Tulach 2007-12-11 21:40:47 UTC
Created attachment 54167 [details]
New API based on java.util.concurent.Executor
Comment 4 Jaroslav Tulach 2007-12-11 21:41:51 UTC
Created attachment 54168 [details]
Sample usage of this API in projects to prevent most common deadlocks
Comment 5 Jaroslav Tulach 2007-12-11 21:43:43 UTC
I believe that this issue, together with issue 91291 can improve UI responsivness of project customizers. Please check 
the API and proposed impls.
Comment 6 Jesse Glick 2007-12-11 22:50:47 UTC
Typo in apichanges: "priviledged"
Comment 7 Jaroslav Tulach 2008-01-02 12:50:29 UTC
Created attachment 54593 [details]
Imporved patch that makes sure that only first entrace to the mutex invokes the Executor
Comment 8 Jaroslav Tulach 2008-01-02 12:51:16 UTC
Unless somebody objects, I'll integrate tomorrow.