Author: toad
Date: 2008-08-29 21:31:11 +0000 (Fri, 29 Aug 2008)
New Revision: 22221

Modified:
   branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
Log:
Deactivate cb if it was deactivated when entered finish()


Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java        
2008-08-29 21:29:28 UTC (rev 22220)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java        
2008-08-29 21:31:11 UTC (rev 22221)
@@ -419,6 +419,7 @@
                        container.activate(cb, 1);
                }
                context.getChkFetchScheduler().removePendingKeys(this, true);
+               boolean cbWasActive = true;
                try {
                        synchronized(this) {
                                if(otherFailure != null) throw otherFailure;
@@ -434,7 +435,9 @@
                                container.set(this);
                                container.activate(decompressors, 5);
                                container.activate(returnBucket, 5);
-                               container.activate(cb, 1);
+                               cbWasActive = container.ext().isActive(cb);
+                               if(!cbWasActive)
+                                       container.activate(cb, 1);
                                container.activate(fetchContext, 1);
                        }
                        int count = 0;
@@ -473,6 +476,8 @@
                        Logger.error(this, "Caught "+t, t);
                        cb.onFailure(new 
FetchException(FetchException.INTERNAL_ERROR, t), this, container, context);
                }
+               if(!cbWasActive)
+                       container.deactivate(cb, 1);
        }

        public void schedule(ObjectContainer container, ClientContext context) 
throws KeyListenerConstructionException {


Reply via email to