You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Norman Maurer (Commented) (JIRA)" <se...@james.apache.org> on 2011/10/07 15:27:29 UTC
[jira] [Commented] (JAMES-1327)
FileSystemBlobStrategy#getFile(ActiveMQBlobMessage) is not thread safe
(throws "java.io.IOException: Unable to create directory")
[ https://issues.apache.org/jira/browse/JAMES-1327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13122788#comment-13122788 ]
Norman Maurer commented on JAMES-1327:
--------------------------------------
What about creating a patch file... We love contributions :)
> FileSystemBlobStrategy#getFile(ActiveMQBlobMessage) is not thread safe (throws "java.io.IOException: Unable to create directory")
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: JAMES-1327
> URL: https://issues.apache.org/jira/browse/JAMES-1327
> Project: JAMES Server
> Issue Type: Bug
> Components: Queue
> Affects Versions: 3.0-beta3
> Environment: At least Windows and Linux.
> Reporter: Michael Herrmann
>
> Consider org.apache.james.queue.activemq.FileSystemBlobStrategy#getFile(ActiveMQBlobMessage):
> protected File getFile(ActiveMQBlobMessage message) throws JMSException, IOException {
> ...
> // check if we need to create the queue folder
> if (queueF.exists() == false) {
> if (!queueF.mkdirs()) {
> throw new IOException("Unable to create directory " + queueF.getAbsolutePath());
> }
> }
> ...
> }
> Suppose this method is called from two threads. If both threads get past the condition
> if (queueF.exists() == false),
> then the first one will create queueF. For the second, queueF.mkdirs() will then return false, which leads to an IOException even though everything is fine. I think the condition should be replaced by
> if (!queueF.mkdirs() && !queueF.exists()).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org