Author: toad
Date: 2008-10-22 15:11:47 +0000 (Wed, 22 Oct 2008)
New Revision: 23034

Modified:
   branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
Log:
Remove "chosen". This is not compatible with persistent selection.


Modified: 
branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java   
2008-10-22 12:49:39 UTC (rev 23033)
+++ branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java   
2008-10-22 15:11:47 UTC (rev 23034)
@@ -33,7 +33,6 @@
        /** It is essential that we know when the cooldown will end, otherwise 
we cannot 
         * remove the key from the queue if we are killed before that */
        long cooldownWakeupTime;
-       private boolean chosen;

        protected BaseSingleFileFetcher(ClientKey key, int maxRetries, 
FetchContext ctx, ClientRequester parent) {
                super(parent);
@@ -63,10 +62,6 @@
                if(persistent)
                        container.activate(key, 5);
                if(fetching.hasKey(key.getNodeKey())) return null;
-               if(chosen) return null;
-               chosen = true;
-               if(persistent)
-                       container.store(this);
                return keys[0];
        }

@@ -74,7 +69,6 @@
        public boolean hasValidKeys(KeysFetchingLocally fetching, 
ObjectContainer container, ClientContext context) {
                if(persistent)
                        container.activate(key, 5);
-               if(chosen) return false;
                return !fetching.hasKey(key.getNodeKey());
        }

@@ -99,7 +93,6 @@
         * @param sched */
        protected boolean retry(ObjectContainer container, ClientContext 
context) {
                retryCount++;
-               chosen = false;
                if(Logger.shouldLog(Logger.MINOR, this))
                        Logger.minor(this, "Attempting to retry... (max 
"+maxRetries+", current "+retryCount+ ')');
                // We want 0, 1, ... maxRetries i.e. maxRetries+1 attempts 
(maxRetries=0 => try once, no retries, maxRetries=1 = original try + 1 retry)
@@ -178,7 +171,7 @@
        }

        public synchronized boolean isEmpty(ObjectContainer container) {
-               return cancelled || finished || chosen;
+               return cancelled || finished;
        }

        @Override
@@ -202,7 +195,6 @@
                        container.activate(this.key, 5);
                }
                synchronized(this) {
-                       chosen = true;
                        if(finished) {
                                if(Logger.shouldLog(Logger.MINOR, this))
                                        Logger.minor(this, "onGotKey() called 
twice on "+this, new Exception("debug"));


Reply via email to