Index: src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java =================================================================== --- src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java (revision 1180047) +++ src/main/java/org/apache/james/queue/activemq/FileSystemBlobStrategy.java (revision ) @@ -144,11 +144,16 @@ File queueF = fs.getFile(queueUrl); // check if we need to create the queue folder - if (queueF.exists() == false) { + if (!queueF.exists()) { if (!queueF.mkdirs()) { + // It could be that queueF.mkdirs() returned false because queueF has been created + // in the meantime (eg. by a different thread). Only throw an exception if this is + // not the case. + if (!queueF.exists()) { - throw new IOException("Unable to create directory " + queueF.getAbsolutePath()); - } - } + throw new IOException("Unable to create directory " + queueF.getAbsolutePath()); + } + } + } return fs.getFile(queueUrl + "/" + filename); }