Bug 123899 - Simple way to run atomic action without having a fileobject
Simple way to run atomic action without having a fileobject
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Filesystems
6.x
All All
: P3 (vote)
: 6.x
Assigned To: rmatous
issues@platform
: API_REVIEW_FAST
Depends on:
Blocks: 123832
  Show dependency treegraph
 
Reported: 2007-12-12 17:52 UTC by Jaroslav Tulach
Modified: 2008-12-22 11:52 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Suggested patch (6.45 KB, patch)
2008-01-04 13:54 UTC, rmatous
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo