On Wednesday 29 April 2009 02:58:48 Daniel Cheng wrote:
> On Wed, Apr 29, 2009 at 9:21 AM, Matthew Toseland
> <toad at amphibian.dyndns.org> wrote:
> > On Tuesday 21 April 2009 08:55:53 j16sdiz at freenetproject.org 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.

Doh! But why the inputStreams inc move?
> 
> >>
> >> 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
> >> cvs at freenetproject.org
> >> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> >>
> >>
> >
> >
> >
> > _______________________________________________
> > Devl mailing list
> > Devl at freenetproject.org
> > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
> >
> _______________________________________________
> Devl mailing list
> Devl at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20090429/26aaf0f8/attachment.pgp>

Reply via email to