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 14558 - Duplicate FileEvent's being received
Summary: Duplicate FileEvent's being received
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks: 13921
  Show dependency tree
 
Reported: 2001-08-19 12:35 UTC by Jesse Glick
Modified: 2008-12-22 20:59 UTC (History)
0 users

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 Jesse Glick 2001-08-19 12:35:43 UTC
[dev aug 17] ModuleList sometimes receives more file events than it
ought to. For example, after disabling a module (e.g. RMI) via the
GUI, which causes the module system to rewrite its XML on disk (e.g.
Modules/org-netbeans-modules-rmi.xml) using
FileSystem.runAtomicAction, the file listener on the Modules/ folder
later receives two file change events, apparently identical including
timestamp:

org.openide.filesystems.FileEvent[source=Modules][file=Modules/org-netbeans-modules-rmi.xml,time=998071494763,expected=false]

The first is ignored (because ModuleList was expecting to get one such
change after rewriting the XML file), but the second appears to be an
externally-initiated change and so ModuleList does extra work checking
whether the XML on disk still matches the actual state of the module.
Though it will find that everything is still OK and do nothing, some
time was wasted doing this check, and under some circumstances the
extra event could cause synchronization bugs.

Radek do you know of any problems in FileSystems API that would cause
the filesystem to fire duplicate file events? In this example the file
was on the system file system; originally only in the netbeans.home
layer; ModuleList inside an atomic block got its lock then output
stream, wrote some content (thus to the netbeans.user layer), then
released the lock and exited the block. The FileListener was attached
to the containing folder Modules/ during IDE startup.
Comment 1 rmatous 2001-11-15 10:18:30 UTC
Probably source of this problem is meachanism that is used to modify 
content of FileObject using output stream: from read-only layer is 
file copied on writable layer. This should be done transparently for 
MFO user without firing any events.  
Comment 2 Jesse Glick 2001-11-15 12:15:50 UTC
Right, if a file already exists in an MFO, moving it to a different
layer by writing to it should just fire the one FileChangeEvent and no
more, I think... are there any unit tests covering this sort of thing?
Comment 3 rmatous 2001-11-21 09:57:37 UTC
Fixed in trunk. MFO.getOutputStream doesn`t fire fileChangeEvent any 
more. Only close of stream will fire fileChangeEvent. You are right 
that this problem should be covered with unit test: so new 
testGetOutputStream1 was added.
Comment 4 Quality Engineering 2003-07-01 15:59:44 UTC
Resolved for 3.4.x or earlier, no new info since then -> verified
Comment 5 Quality Engineering 2003-07-01 16:33:22 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.