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 "Felix Knecht (Commented) (JIRA)" <ji...@apache.org> on 2011/09/29 16:02:45 UTC
[jira] [Commented] (MAILBOX-141) Do not synchronize on objects that
may be reused
[ https://issues.apache.org/jira/browse/MAILBOX-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13117305#comment-13117305 ]
Felix Knecht commented on MAILBOX-141:
--------------------------------------
@Norman
I'm not that in 'synchronized'. Do you think this would be ok?
Index: LazyMessageSearchIndex.java
===================================================================
--- LazyMessageSearchIndex.java (revision 1176826)
+++ LazyMessageSearchIndex.java (working copy)
@@ -81,8 +81,9 @@
if (oldDone != null) {
done = oldDone;
}
- synchronized (done) {
- Iterator<Message<Id>> messages = getFactory().getMessageMapper(session).findInMailbox(mailbox, MessageRange.all(), FetchType.Full, -1);
+ Iterator<Message<Id>> messages = null;
+ synchronized (messages) {
+ messages = getFactory().getMessageMapper(session).findInMailbox(mailbox, MessageRange.all(), FetchType.Full, -1);
while(messages.hasNext()) {
final Message<Id> message = messages.next();
try {
> Do not synchronize on objects that may be reused
> ------------------------------------------------
>
> Key: MAILBOX-141
> URL: https://issues.apache.org/jira/browse/MAILBOX-141
> Project: James Mailbox
> Issue Type: Bug
> Components: store
> Affects Versions: 0.4
> Reporter: Felix Knecht
> Priority: Critical
>
> public Iterator<Long> search has a synchronization on the Boolean 'done'
> https://builds.apache.org/view/G-L/view/James/job/mailbox-site/site/apache-james-mailbox-store/findbugs.html#org.apache.james.mailbox.store.search.LazyMessageSearchIndex
> See
> http://findbugs.sourceforge.net/bugDescriptions.html#DL_SYNCHRONIZATION_ON_BOOLEAN
> https://www.securecoding.cert.org/confluence/display/java/LCK01-J.+Do+not+synchronize+on+objects+that+may+be+reused
--
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