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 58642 - Missing synchronization of getters that return singleton instances
Summary: Missing synchronization of getters that return singleton instances
Status: CLOSED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2005-05-06 10:23 UTC by Martin Entlicher
Modified: 2010-04-29 09:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The patch that fixes this. (1.62 KB, patch)
2005-05-06 10:25 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2005-05-06 10:23:02 UTC
In DebuggerEngine and DebuggerManager there are are get* methods, that are not
synchronized, but apparently should return the same instance each time. The
instance is constructed lazily upon the first call to the method.
Comment 1 Martin Entlicher 2005-05-06 10:25:13 UTC
Created attachment 22005 [details]
The patch that fixes this.
Comment 2 Martin Entlicher 2005-05-06 10:25:59 UTC
Since this is an API change, a fast API review is necessary.
Comment 3 Jaroslav Tulach 2005-05-09 13:28:11 UTC
Looks like no brainer to me. Just make sure you do not call foreign code from 
the synchronized methods, as that could lead to deadlocks. 
Comment 4 Martin Entlicher 2005-05-10 10:02:01 UTC
No foreign code is called from the synchronized methods, just almost empty
constructors. Thanks for comments.
Comment 5 Jaroslav Tulach 2005-05-10 12:50:44 UTC
I had problems with "almost empty" constructors in Lookups.metaInfServices, 
but apparently there is no easy way around that, except documenting that the 
constructors cannot wait on any lock - e.g. be empty. If there is a place to 
put such warning (constructors are supposed to be empty) in documentation, I 
advice your to put it there. 
Comment 6 Martin Entlicher 2005-05-16 15:34:14 UTC
Thanks for comments, will put the fix in.
The constructors are private. I'll add the comment concerning call of foreign
code into their javadoc.
Comment 7 Martin Entlicher 2005-05-16 15:36:41 UTC
Fixed in trunk:

/cvs/debuggercore/api/src/org/netbeans/api/debugger/ActionsManager.java,v  <-- 
ActionsManager.java
new revision: 1.14; previous revision: 1.13

/cvs/debuggercore/api/src/org/netbeans/api/debugger/DebuggerEngine.java,v  <-- 
DebuggerEngine.java
new revision: 1.9; previous revision: 1.8

/cvs/debuggercore/api/src/org/netbeans/api/debugger/DebuggerManager.java,v  <--
 DebuggerManager.java
new revision: 1.19; previous revision: 1.18
Comment 8 Quality Engineering 2010-04-29 09:22:30 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.