Re: [mule-scm] [mule] [14840] branches/mule-3.x: remove the safehaus jug dependency

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [mule-scm] [mule] [14840] branches/mule-3.x: remove the safehaus jug dependency

by Daniel Feist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FYI this introduced concurrency issues. See MULE-4563

I assume the idea was to speed things up by avoiding unnecessary  calls to mkdirs() so I'll make this thread-safe rather than rollback.

Dan


On May 28, 2009, at 7:27 PM, rossmason@... wrote:

     public Object store(String queue, Object obj) throws IOException
     {
         String id = getId(obj);
         File file = FileUtils.newFile(store, queue + File.separator + id + EXTENSION);
-        file.getParentFile().mkdirs();
+        if(!file.getParentFile().exists() && !file.getParentFile().mkdirs())
+        {
+            throw new IOException("Failed to create directory: " + file.getAbsolutePath());
+        }
         ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
         oos.writeObject(obj);
         oos.close();