On Thursday 23 October 2008 04:28, Daniel Cheng wrote:
> On Thu, Oct 23, 2008 at 6:40 AM,  <[EMAIL PROTECTED]> wrote:
> > Author: nextgens
> > Date: 2008-10-22 22:40:31 +0000 (Wed, 22 Oct 2008)
> > New Revision: 23041
> >
> > Modified:
> >   trunk/freenet/src/freenet/client/async/SingleFileInserter.java
> > Log:
> > serialize compression so that we don't run out of memory
> 
> 
> >
> > Modified: trunk/freenet/src/freenet/client/async/SingleFileInserter.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/client/async/SingleFileInserter.java      
2008-10-22 22:39:23 UTC (rev 23040)
> > +++ trunk/freenet/src/freenet/client/async/SingleFileInserter.java      
2008-10-22 22:40:31 UTC (rev 23041)
> [...]
> > -       private class OffThreadCompressor implements Runnable {
> > +       // Use a mutex to serialize compression (limit memory usage/IO)
> > +       // Of course it doesn't make any sense on multi-core systems.
> > +       private static final Object compressorSync = new Object();
> 
> use java.util.concurrent.Semaphore if you want the number of
> concurrent compressor adjustable.

Nice. I'm not sure either solution is acceptable long term ... there is 
significant refactoring in the db4o branch on this (and FEC too) ... iirc I 
don't limit the number running though ...
> 
> > +
> > +       private  class OffThreadCompressor implements Runnable {
> >                public void run() {
> >                    freenet.support.Logger.OSThread.logPID(this);
> >                        try {
> > @@ -138,6 +134,7 @@
> >        }
> >
> >        private void tryCompress() throws InsertException {
> > +               synchronized(compressorSync) {

Attachment: pgp1Q6WNLIlzI.pgp
Description: PGP signature

_______________________________________________
Devl mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to