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 18110 - DataObject synchronize on this.
Summary: DataObject synchronize on this.
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: phamernik
URL:
Keywords:
: 18145 (view as bug list)
Depends on:
Blocks: 17941
  Show dependency tree
 
Reported: 2001-11-27 12:57 UTC by _ lkramolis
Modified: 2008-12-22 17:38 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Proposed patch. (4.39 KB, patch)
2001-11-27 12:59 UTC, _ lkramolis
Details | Diff
DataObject patch (8.84 KB, patch)
2001-11-29 17:05 UTC, phamernik
Details | Diff
MultiDataObject patch (16.71 KB, patch)
2001-11-29 17:12 UTC, phamernik
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ lkramolis 2001-11-27 12:57:08 UTC
DataObject's methods delete and rename are synchronized on this. It is dangerous
and could cause deadlock, e.g. #17941.
Comment 1 _ lkramolis 2001-11-27 12:59:09 UTC
Created attachment 3590 [details]
Proposed patch.
Comment 2 phamernik 2001-11-29 17:02:07 UTC
I discussed the synchronization model of DataObject and
MultiDAtaObject with Yarda. It seems it'd be better to rewrite it a
little bit. I'd like to propose the following changes and commit them
tomorrow. Attached are both diffs.

DataObject changes:
------------------
1) DataObject - new virtual package private method added -
synchObject() - in DataObject returns this
2) DataObject's synchronized methods - the lock changed from this
to synchObject's method return value (delete, rename, move). Events'
firing are outside of synchronized blocks.
3) listeners() method is synchronized to new static field
(listenersMethodLock)

MultiDataObject changes:
-----------------------
1) getCookieSet and setCookieSet methods are synchronized on special
static field - cookieSetLock (instead of 'this' before)
2) getPrimaryEntry method is not synchronized on special object
syncObject anymore. The method is not synchronized, because
initialization of 'primary' field was moved to constructor.
3) synchObject is changed in MultiDataObject and returns the returned
value from secondary() method.
4) handleCopy, handleMove and handleRename are not synchronized
anymore, because these methods are called from synchronized methods of
DataObject (rename, delete and move)
Comment 3 phamernik 2001-11-29 17:05:41 UTC
Created attachment 3628 [details]
DataObject patch
Comment 4 phamernik 2001-11-29 17:12:27 UTC
Created attachment 3630 [details]
MultiDataObject patch
Comment 5 phamernik 2001-11-29 17:15:40 UTC
I am adding Vita and Yarda to CC. If you have time, would you look at
the changes, please? Thanks.
Comment 6 _ pkuzel 2001-11-29 17:27:27 UTC
Why does synchObject() of DataObject return this? Imagine someone
(from another package) extenting it. It will result in synchonizing at
a public lock (the this) that is often dangerous.
Comment 7 phamernik 2001-11-30 11:18:52 UTC
Ok, I agree. I changed the synchronization of DataObject from this to
primaryFileListener (private field).
Comment 8 phamernik 2001-11-30 11:24:12 UTC
The patch is applied in release33 branch. I am going to propose to
make  3.3.0_WAIVER from this bug.
Comment 9 phamernik 2001-11-30 11:57:27 UTC
*** Issue 18145 has been marked as a duplicate of this issue. ***
Comment 10 Jan Zajicek 2001-12-03 15:39:36 UTC
Marking as verified. This will not go into release330. If some weird
stuff occurs in release33 feel free to reopen.
Comment 11 Quality Engineering 2003-07-01 16:37:35 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.