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 123899

Summary: Simple way to run atomic action without having a fileobject
Product: platform Reporter: Jaroslav Tulach <jtulach>
Component: FilesystemsAssignee: rmatous <rmatous>
Status: RESOLVED FIXED    
Severity: blocker CC: apireviews, mkubec
Priority: P3 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 123832    
Attachments: Suggested patch

Description Jaroslav Tulach 2007-12-12 17:52:43 UTC
For implementation of issue 123832, especially its patch in ProjectManager:
http://www.netbeans.org/nonav/issues/showattachment.cgi/54168/123832-mutex-use-in-project-api.diff
I need to run a runnable in atomic action without actually knowing any fileobject or filesystem. 

It would be very good to have:

public static void FileUtil.runAtomicAction(FileSystem.AtomicAction action) throws IOException;
public static void FileUtil.runAtomicAction(Runnable action);

that would block events on all (known) filesystems. 


Moreover it would be excellent, if there also was

public static final FileUtil.Executor ATOMIC_ACTION;

delegating to FileUtil.runAtomicAction(Runnable). This would completely simplified the code in ProjectManager to 
one-liner and others could use it too.
Comment 1 Jaroslav Tulach 2007-12-12 17:54:44 UTC
Radek, please implement this little enhancement for the benefit of everyone.
Comment 2 rmatous 2008-01-04 13:54:47 UTC
Created attachment 54688 [details]
Suggested patch
Comment 3 rmatous 2008-01-04 13:59:04 UTC
Patch+API change+Test submitted as attachment. FileUtil.Executor not included, because I don't find it much handy. 
Comment 4 Jaroslav Tulach 2008-01-04 15:38:56 UTC
OK with me. Up to Milan to decide if this is acceptable API for him, as this means he will have to write the executor 
himself.
Comment 5 rmatous 2008-01-04 15:59:51 UTC
Iff it was OK for Milan, someone else might require different impl.  The simplest executor 1 - 3 lines of code for everyone
Comment 6 Milan Kubec 2008-01-04 17:16:07 UTC
I think that it's OK even without executor support.
Comment 7 rmatous 2008-01-07 09:50:26 UTC
Will be integrated tomorrow 
Comment 8 rmatous 2008-01-08 10:53:04 UTC
Fixed:
/cvs/openide/fs/src/org/openide/filesystems/FileUtil.java,v  <--  FileUtil.java
new revision: 1.50; previous revision: 1.49

/cvs/openide/fs/test/unit/src/org/openide/filesystems/FileUtilTestHidden.java,v  <--  FileUtilTestHidden.java
new revision: 1.6; previous revision: 1.5

/cvs/openide/fs/manifest.mf,v  <--  manifest.mf
new revision: 1.13; previous revision: 1.12

/cvs/openide/fs/apichanges.xml,v  <--  apichanges.xml
new revision: 1.17; previous revision: 1.16