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 112277 - Needless WeakList class
Summary: Needless WeakList class
Status: VERIFIED WONTFIX
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Vladimir Kvashin
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2007-08-08 09:59 UTC by _ rkubacki
Modified: 2007-11-26 15:26 UTC (History)
1 user (show)

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 _ rkubacki 2007-08-08 09:59:03 UTC
class WeakList<T> implements Iterable<T> provides only subset of functionality of WeakSet<T> in org.openide.util.
Comment 1 Vladimir Kvashin 2007-11-26 10:37:32 UTC
I agree that WeakSet does the same and more; but it isn't concurrent. Our WeakList ensures concurrency, which is quite
important for C/C++ Language Model. If we use WeakSet, we have to either copy-paste concurrency-related code into the
places that use it or to wrap it into another class that ensures concurrency.

Comment 2 Petr Nejedly 2007-11-26 10:55:40 UTC
Concurrency is a matter of Collections.synchronizedSet(new WeakSet()), but I'm more worried about the usage of WeakList.
You do a lot of source-weak listening, which is quite unusual pattern. You could still have used WeakListeners class for
this purpose, though.
Comment 3 Vladimir Kvashin 2007-11-26 14:53:27 UTC
The Set that is returned by Collections.synchronizedSet()
has non-synchroneous iterator (I mean iterating it while other thread adds elements leads to CME),
while WeakList copies the listener list under lock, then returns the iterator over this copy.

As to the usage of this weak list, probably it should be reviewed.
But the initial request - as I understand - was to change WeakList to WeakSet.
I don't think this should be done.
Comment 4 Petr Nejedly 2007-11-26 15:24:38 UTC
OK, agreed.
Comment 5 Petr Nejedly 2007-11-26 15:26:24 UTC
x