Author: toad
Date: 2008-12-18 00:33:00 +0000 (Thu, 18 Dec 2008)
New Revision: 24500

Modified:
   branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
Log:
Make codec transient, create it when we need it. It really shouldn't be 
persistent.


Modified: 
branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-12-18 00:30:02 UTC (rev 24499)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java 
2008-12-18 00:33:00 UTC (rev 24500)
@@ -104,7 +104,7 @@
                return hashCode;
        }
        
-       private FECCodec codec;
+       private transient FECCodec codec;
        
        public SplitFileFetcherSegment(short splitfileType, ClientCHK[] 
splitfileDataKeys, ClientCHK[] splitfileCheckKeys, SplitFileFetcher fetcher, 
ArchiveContext archiveContext, FetchContext blockFetchContext, long 
maxTempLength, int recursionLevel, ClientRequester requester, int segNum, 
boolean ignoreLastDataBlock) throws MetadataParseException, FetchException {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
@@ -342,8 +342,6 @@
                // Now decode
                if(logMINOR) Logger.minor(this, "Decoding 
"+SplitFileFetcherSegment.this);
 
-               if(codec == null)
-               codec = FECCodec.getCodec(splitfileType, dataKeys.length, 
checkKeys.length, context.mainExecutor);
                if(persistent)
                        container.store(this);
                
@@ -391,6 +389,8 @@
                        }
                        if(persistent)
                                container.activate(parent, 1);
+                       if(codec == null)
+                               codec = FECCodec.getCodec(splitfileType, 
dataKeys.length, checkKeys.length, context.mainExecutor);
                        FECJob job = new FECJob(codec, queue, dataBuckets, 
checkBuckets, CHKBlock.DATA_LENGTH, context.getBucketFactory(persistent), this, 
true, parent.getPriorityClass(), persistent);
                        codec.addToQueue(job, 
                                        queue, container);
@@ -411,6 +411,8 @@
                        container.activate(parent, 1);
                        container.activate(context, 1);
                }
+               if(codec == null)
+                       codec = FECCodec.getCodec(splitfileType, 
dataKeys.length, checkKeys.length, context.mainExecutor);
                // Because we use SplitfileBlock, we DON'T have to copy here.
                // See FECCallback comments for explanation.
                try {
@@ -501,9 +503,6 @@
                 */
 
                // Encode any check blocks we don't have
-               if(codec == null)
-                       codec = FECCodec.getCodec(splitfileType, 
dataKeys.length, checkKeys.length, context.mainExecutor);
-
                codec.addToQueue(new FECJob(codec, context.fecQueue, 
dataBuckets, checkBuckets, 32768, context.getBucketFactory(persistent), this, 
false, parent.getPriorityClass(), persistent),
                                context.fecQueue, container);
                if(persistent) {

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

Reply via email to