* Matthew Toseland <toad at amphibian.dyndns.org> [2008-08-27 19:04:46]:

> On Monday 25 August 2008 23:34, Florent Daigni?re wrote:
> > * Matthew Toseland <toad at amphibian.dyndns.org> [2008-08-25 23:27:59]:
> > 
> > > On Monday 25 August 2008 22:45, Florent Daigni?re wrote:
> > > > * Matthew Toseland <toad at amphibian.dyndns.org> [2008-08-25 22:15:24]:
> > > > 
> > > > > On Monday 25 August 2008 14:46, nextgens at freenetproject.org wrote:
> > > > > > Author: nextgens
> > > > > > Date: 2008-08-25 13:46:46 +0000 (Mon, 25 Aug 2008)
> > > > > > New Revision: 22133
> > > > > > 
> > > > > > Modified:
> > > > > >    trunk/freenet/src/freenet/node/NodeClientCore.java
> > > > > >    trunk/freenet/src/freenet/support/io/ArrayBucket.java
> > > > > >    trunk/freenet/src/freenet/support/io/ArrayBucketFactory.java
> > > > > >    
> > > > > 
> trunk/freenet/src/freenet/support/io/PaddedEphemerallyEncryptedBucket.java
> > > > > >    trunk/freenet/src/freenet/support/io/TempBucketFactory.java
> > > > > >    
> trunk/freenet/test/freenet/clients/http/filter/ContentFilterTest.java
> > > > > >    
> trunk/freenet/test/freenet/support/compress/GzipCompressorTest.java
> > > > > > Log:
> > > > > > TempBucketFactory: it is *very* unlikely that it won't break 
> > > > > > things! 
> If 
> > > it 
> > > > > doesn't it should speed things up significantly and solve the OOM 
> problems 
> > > a 
> > > > > few users have been reporting.
> > > > > > 
> > 
> > [...]
> > 
> > > > > > +           private final void migrateToFileBucket() throws 
> > > > > > IOException {
> > > > > > +                   Bucket toMigrate = null;
> > > > > > +                   synchronized(currentBucket) {
> > > > > 
> > > > > You shouldn't synchronize on it if it is going to change. Can't you 
> use 
> > > > > synchronized(this)?
> > > > 
> > > > We need a shared lock on the Streams too... but yes I could do it
> > > 
> > > Sure, they'd be synchronized(TempBucket.this).
> > 
> > I've created a dedicated sync. object
> > 
> > > > > > +                   @Override
> > > > > > +                   public void flush() throws IOException {
> > > > > > +                           synchronized(currentBucket) {
> > > > > > +                                   
> > > > > > _maybeMigrateRamBucket(currentSize);
> > > > > > +                                   _maybeResetOutputStream();
> > > > > > +                                   os.flush();
> > > > > > +                           }
> > > > > > +                   }
> > > > > 
> > > > > No point flushing *after* you've reset the OS, is there? Migrating 
> will 
> > > > > close() and therefore flush. Of course if you don't, you do want to 
> call 
> > > > > flush() here.
> > > > 
> > > > If there is a BufferedOuputStream involved on the underlying buckets it
> > > > will clobber any IOException thrown on close() hence flushing is a good
> > > > idea.
> 
> I mean why flush it if we've just opened it?

Right, we don't need to do it in that case
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080827/35d85d5b/attachment.pgp>

Reply via email to