[
https://issues.apache.org/jira/browse/IMAP-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim-Christian Mundt updated IMAP-164:
-------------------------------------
Attachment: uniquemailbox2.diff
Norman,
it's more complicated than it looks like at first glance. Could you already
test that? Just from reading I think it doesn't really work because when a
duplicate occurs, OpenJPA automatically rolls back so there is not need to call
rollback() again. See this trace:
1552 JPA-Tests TRACE [main] openjpa.Runtime - An exception occurred while
ending the transaction. This exception will be re-thrown.
<openjpa-2.0.0-r422266:935683 fatal store error>
org.apache.openjpa.util.StoreException: The transaction has been rolled back.
See the nested exceptions for details on the errors that occurred.
Moreover, rollback() will never be called because
AbstractTransactionalMapper.execute() only checks for MailboxException, but a
RollbackException is thrown which is not a subtype.
However, your idea to override one of the transaction methods seems to be the
best way. I think we would need to override commit() like in the patch.
Two remarks: the RollbackException is not thrown during rollback but when a
duplicate entry occurs (provoking a rollback) and I'd prefer the name
"lastMailboxName" in order not to confuse anybody that the mapper might be
bound to a specific mailbox.
> Move mailboxExists to MailboxMapper interface
> ---------------------------------------------
>
> Key: IMAP-164
> URL: https://issues.apache.org/jira/browse/IMAP-164
> Project: JAMES Imap
> Issue Type: Improvement
> Components: Mailbox
> Reporter: Tim-Christian Mundt
> Assignee: Norman Maurer
> Priority: Minor
> Attachments: existsViaFindByName.patch, uniquemailbox.diff,
> uniquemailbox2.diff
>
>
> The method MailboxMapper.countMailboxesWithName(mailboxName) is
> only ever used in StoreMailboxManager.mailboxExists(mailboxName,
> session). There the result is checked for duplicates. Duplicates should
> be detected before writing and not when reading, for some stores (e.g.
> maildir) it is not even possible to have more than one mailbox with the
> same name. So this is superfluous and should should be moved to
> MailboxMapper.existsMailbox(mailboxName) which can provide a more
> efficient existence test.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]