[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Classpathx-javamail] Method MaildirFolder.appendMessages Optimizati
From: |
Chris Burdess |
Subject: |
Re: [Classpathx-javamail] Method MaildirFolder.appendMessages Optimizations |
Date: |
Sat, 18 Jan 2014 16:54:42 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 18/01/14 00:40, Conrad T. Pino wrote:
>
> I propose 2 optimizations to Subject method:
>
> 1. Since Subject method is declared synchronized the synchronized block
> consisting of lines 429-430 & 501 is pointless.
>
> 2. The if statements at lines 499 and 503 should be merged.
>
> If the original intent was to conduct notifyMessageAddedListeners outside
> the lock scope then the Subject method declaration should not be
> synchronized.
The method declaration needs to be not synchronized, so that we can
actually fire the events outside the synchronized block.
> This is a very small nit:
>
> * Line 500 reads: appended.toArray(n);
>
> * I suggest "n = appended.toArray(n);" is a worthwhile defense against
> non-compliant implementations.
> * I suppose implementations could be non-compliant in the other
> direction too.
> * What does our collective experience suggest as the best practice?
If the implementation is this broken you probably have worse things to
worry about. Certainly I've never come across an implementation that
didn't do what the API says it does for this method.