Author: toad
Date: 2008-11-07 20:22:31 +0000 (Fri, 07 Nov 2008)
New Revision: 23386

Modified:
   trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
   trunk/freenet/src/freenet/client/InsertContext.java
   trunk/freenet/src/freenet/node/NodeClientCore.java
Log:
ONE global RealCompressor thread.


Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2008-11-07 20:16:05 UTC (rev 23385)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2008-11-07 20:22:31 UTC (rev 23386)
@@ -221,7 +221,7 @@
                                forceNonPersistent ? 
NullPersistentFileTracker.getInstance() : persistentFileTracker,
                                random, INSERT_RETRIES, 
CONSECUTIVE_RNFS_ASSUME_SUCCESS,
                                SPLITFILE_INSERT_THREADS, 
SPLITFILE_BLOCKS_PER_SEGMENT, SPLITFILE_CHECK_BLOCKS_PER_SEGMENT, 
-                               globalEventProducer, cacheLocalRequests, 
core.uskManager, blockEncoder, core.getExecutor());
+                               globalEventProducer, cacheLocalRequests, 
core.uskManager, blockEncoder, core.getExecutor(), core.compressor);
        }

        public FreenetURI[] generateKeyPair(String docName) {

Modified: trunk/freenet/src/freenet/client/InsertContext.java
===================================================================
--- trunk/freenet/src/freenet/client/InsertContext.java 2008-11-07 20:16:05 UTC 
(rev 23385)
+++ trunk/freenet/src/freenet/client/InsertContext.java 2008-11-07 20:22:31 UTC 
(rev 23386)
@@ -39,7 +39,7 @@

        public InsertContext(BucketFactory bf, BucketFactory persistentBF, 
PersistentFileTracker tracker, RandomSource random,
                        int maxRetries, int rnfsToSuccess, int maxThreads, int 
splitfileSegmentDataBlocks, int splitfileSegmentCheckBlocks,
-                       ClientEventProducer eventProducer, boolean 
cacheLocalRequests, USKManager uskManager, BackgroundBlockEncoder blockEncoder, 
Executor executor) {
+                       ClientEventProducer eventProducer, boolean 
cacheLocalRequests, USKManager uskManager, BackgroundBlockEncoder blockEncoder, 
Executor executor, RealCompressor compressor) {
                this.bf = bf;
                this.persistentFileTracker = tracker;
                this.persistentBucketFactory = persistentBF;
@@ -56,8 +56,7 @@
                this.cacheLocalRequests = cacheLocalRequests;
                this.backgroundBlockEncoder = blockEncoder;
                this.executor = executor;
-               this.compressor = new RealCompressor(executor);
-               executor.execute(compressor, "Compression scheduler");
+               this.compressor = compressor;
        }

        public InsertContext(InsertContext ctx, SimpleEventProducer producer, 
boolean forceNonPersistent) {

Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java  2008-11-07 20:16:05 UTC 
(rev 23385)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java  2008-11-07 20:22:31 UTC 
(rev 23386)
@@ -57,6 +57,7 @@
 import freenet.support.api.LongCallback;
 import freenet.support.api.StringArrCallback;
 import freenet.support.api.StringCallback;
+import freenet.support.compress.RealCompressor;
 import freenet.support.io.FileUtil;
 import freenet.support.io.FilenameGenerator;
 import freenet.support.io.NativeThread;
@@ -95,6 +96,7 @@
        FProxyToadlet fproxyServlet;
        final SimpleToadletServer toadletContainer;
        public final BackgroundBlockEncoder backgroundBlockEncoder;
+       public final RealCompressor compressor;
        /** If true, requests are resumed lazily i.e. startup does not block 
waiting for them. */
        private boolean lazyResume;
        protected final Persister persister;
@@ -124,6 +126,7 @@
                }
                byte[] pwdBuf = new byte[16];
                random.nextBytes(pwdBuf);
+               compressor = new RealCompressor(node.executor);
                this.formPassword = Base64.encode(pwdBuf);
                alerts = new UserAlertManager(this);
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
@@ -371,7 +374,7 @@
                healingQueue = new 
SimpleHealingQueue(requestStarters.chkPutScheduler,
                        new InsertContext(tempBucketFactory, tempBucketFactory, 
persistentTempBucketFactory,
                        random, 0, 2, 1, 0, 0, new SimpleEventProducer(),
-                       !Node.DONT_CACHE_LOCAL_REQUESTS, uskManager, 
backgroundBlockEncoder, node.executor), RequestStarter.PREFETCH_PRIORITY_CLASS, 
512 /* FIXME make configurable */);
+                       !Node.DONT_CACHE_LOCAL_REQUESTS, uskManager, 
backgroundBlockEncoder, node.executor, compressor), 
RequestStarter.PREFETCH_PRIORITY_CLASS, 512 /* FIXME make configurable */);

                nodeConfig.register("lazyResume", false, sortOrder++, true, 
false, "NodeClientCore.lazyResume",
                        "NodeClientCore.lazyResumeLong", new BooleanCallback() {
@@ -497,7 +500,8 @@
                        tmci.start();
                for(int i = 0; i < clientSlowSerialExecutor.length; i++)
                        clientSlowSerialExecutor[i].start(node.executor, "Heavy 
client jobs runner (" + i + ")");
-
+               node.executor.execute(compressor, "Compression scheduler");
+               
                node.executor.execute(new PrioRunnable() {

                        public void run() {


Reply via email to