On Wed, Apr 29, 2009 at 9:21 AM, Matthew Toseland
<[email protected]> wrote:
> On Tuesday 21 April 2009 08:55:53 [email protected] wrote:
>> Author: j16sdiz
>> Date: 2009-04-21 07:55:52 +0000 (Tue, 21 Apr 2009)
>> New Revision: 27137
>>
>> Modified:
>> trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
>> Log:
>> Fix inputStream count
>
> What's the difference? Apart from your version breaks on an OOM and the
> previous version didn't?
If you close it twice, the counter get decreased twice.
>>
>> Modified: trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
>> ===================================================================
>> --- trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
> 2009-04-21 07:55:31 UTC (rev 27136)
>> +++ trunk/freenet/src/freenet/support/io/PersistentBlobTempBucket.java
> 2009-04-21 07:55:52 UTC (rev 27137)
>> @@ -75,17 +75,15 @@
>> public InputStream getInputStream() throws IOException {
>> if(freed) throw new IOException("Already freed");
>> final FileChannel channel = factory.channel;
>> +
>> + synchronized(PersistentBlobTempBucket.this) {
>> + inputStreams++;
>> + }
>> +
>> return new InputStream() {
>> -
>> private int offset;
>> private boolean closed;
>>
>> - {
>> - synchronized(PersistentBlobTempBucket.this) {
>> - inputStreams++;
>> - }
>> - }
>> -
>> @Override
>> public int read() throws IOException {
>> if (closed) throw new IOException("closed");
>> @@ -130,6 +128,7 @@
>>
>> @Override
>> public void close() {
>> + if (closed) return;
>> closed = true;
>>
>> synchronized(PersistentBlobTempBucket.this) {
>>
>> _______________________________________________
>> cvs mailing list
>> [email protected]
>> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>>
>>
>
>
>
> _______________________________________________
> Devl mailing list
> [email protected]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
>
_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl