[freenet-cvs] r20231 - in branches/db4o/freenet/src/freenet: client/async node

toad at freenetproject.org toad at freenetproject.org
Thu Jun 5 22:24:49 UTC 2008


Author: toad
Date: 2008-06-05 22:24:48 +0000 (Thu, 05 Jun 2008)
New Revision: 20231

Modified:
   branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
   branches/db4o/freenet/src/freenet/client/async/ClientGetState.java
   branches/db4o/freenet/src/freenet/client/async/ClientGetter.java
   branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
   branches/db4o/freenet/src/freenet/client/async/MultiPutCompletionCallback.java
   branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java
   branches/db4o/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java
   branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
   branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
   branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
   branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
   branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
   branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
   branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java
   branches/db4o/freenet/src/freenet/client/async/USKChecker.java
   branches/db4o/freenet/src/freenet/client/async/USKFetcherWrapper.java
   branches/db4o/freenet/src/freenet/node/SendableGet.java
Log:
More, mostly fixing warnings/passing stuff around

Modified: branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/BaseSingleFileFetcher.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -107,7 +107,7 @@
 		return ctx.ignoreStore;
 	}
 
-	public void cancel(ObjectContainer container) {
+	public void cancel(ObjectContainer container, ClientContext context) {
 		synchronized(this) {
 			cancelled = true;
 		}
@@ -135,7 +135,7 @@
 		return true;
 	}
 
-	public void onGotKey(Key key, KeyBlock block, RequestScheduler sched, ObjectContainer container) {
+	public void onGotKey(Key key, KeyBlock block, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		synchronized(this) {
 			if(isCancelled()) return;
 			if(!key.equals(this.key.getNodeKey())) {
@@ -144,7 +144,7 @@
 			}
 		}
 		try {
-			onSuccess(Key.createKeyBlock(this.key, block), false, null, sched, container);
+			onSuccess(Key.createKeyBlock(this.key, block), false, null, sched, container, context);
 		} catch (KeyVerifyException e) {
 			Logger.error(this, "onGotKey("+key+","+block+") got "+e+" for "+this, e);
 			// FIXME if we get rid of the direct route this must call onFailure()

Modified: branches/db4o/freenet/src/freenet/client/async/ClientGetState.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientGetState.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/ClientGetState.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -13,7 +13,7 @@
 
 	public void schedule(ObjectContainer container, ClientContext context);
 
-	public void cancel(ObjectContainer container);
+	public void cancel(ObjectContainer container, ClientContext context);
 
 	public long getToken();
 }

Modified: branches/db4o/freenet/src/freenet/client/async/ClientGetter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientGetter.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/ClientGetter.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -220,7 +220,7 @@
 		}
 	}
 
-	public void cancel(ObjectContainer container) {
+	public void cancel(ObjectContainer container, ClientContext context) {
 		boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		if(logMINOR) Logger.minor(this, "Cancelling "+this);
 		ClientGetState s;
@@ -230,7 +230,7 @@
 		}
 		if(s != null) {
 			if(logMINOR) Logger.minor(this, "Cancelling "+currentState);
-			s.cancel(container);
+			s.cancel(container, context);
 		}
 	}
 

Modified: branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -259,13 +259,13 @@
 				if(logMINOR)
 					Logger.minor(this, "Decode failed: "+e, e);
 				if(!persistent)
-					getter.onFailure(new LowLevelGetException(LowLevelGetException.DECODE_FAILED), tok, this, persistent ? selectorContainer : null);
+					getter.onFailure(new LowLevelGetException(LowLevelGetException.DECODE_FAILED), tok, this, persistent ? selectorContainer : null, clientContext);
 				else {
 					final SendableGet g = getter;
 					final Object token = tok;
 					databaseExecutor.execute(new Runnable() {
 						public void run() {
-							g.onFailure(new LowLevelGetException(LowLevelGetException.DECODE_FAILED), token, ClientRequestScheduler.this, selectorContainer);
+							g.onFailure(new LowLevelGetException(LowLevelGetException.DECODE_FAILED), token, ClientRequestScheduler.this, selectorContainer, clientContext);
 							selectorContainer.commit();
 						}
 					}, NativeThread.NORM_PRIORITY, "Block decode failed");
@@ -275,14 +275,14 @@
 			if(block != null) {
 				if(logMINOR) Logger.minor(this, "Can fulfill "+getter+" ("+tok+") immediately from store");
 				if(!persistent)
-					getter.onSuccess(block, true, tok, this, persistent ? selectorContainer : null);
+					getter.onSuccess(block, true, tok, this, persistent ? selectorContainer : null, clientContext);
 				else {
 					final ClientKeyBlock b = block;
 					final Object t = tok;
 					final SendableGet g = getter;
 					databaseExecutor.execute(new Runnable() {
 						public void run() {
-							g.onSuccess(b, true, t, ClientRequestScheduler.this, selectorContainer);
+							g.onSuccess(b, true, t, ClientRequestScheduler.this, selectorContainer, clientContext);
 						}
 					}, NativeThread.NORM_PRIORITY, "Block found on register");
 				}
@@ -514,7 +514,7 @@
 				for(int i=0;i<transientGets.length;i++) {
 					try {
 						if(logMINOR) Logger.minor(this, "Calling callback for "+transientGets[i]+" for "+key);
-						transientGets[i].onGotKey(key, block, ClientRequestScheduler.this, null);
+						transientGets[i].onGotKey(key, block, ClientRequestScheduler.this, null, clientContext);
 					} catch (Throwable t) {
 						Logger.error(this, "Caught "+t+" running callback "+transientGets[i]+" for "+key);
 					}
@@ -543,7 +543,7 @@
 				for(int i=0;i<gets.length;i++) {
 					try {
 						if(logMINOR) Logger.minor(this, "Calling callback for "+gets[i]+" for "+key);
-						gets[i].onGotKey(key, block, ClientRequestScheduler.this, selectorContainer);
+						gets[i].onGotKey(key, block, ClientRequestScheduler.this, selectorContainer, clientContext);
 					} catch (Throwable t) {
 						Logger.error(this, "Caught "+t+" running callback "+gets[i]+" for "+key);
 					}
@@ -666,7 +666,7 @@
 	public void callFailure(final SendableGet get, final LowLevelGetException e, final Object keyNum, int prio, String name) {
 		databaseExecutor.execute(new Runnable() {
 			public void run() {
-				get.onFailure(e, keyNum, ClientRequestScheduler.this, selectorContainer);
+				get.onFailure(e, keyNum, ClientRequestScheduler.this, selectorContainer, clientContext);
 				selectorContainer.commit();
 			}
 		}, prio, name);

Modified: branches/db4o/freenet/src/freenet/client/async/MultiPutCompletionCallback.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/MultiPutCompletionCallback.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/MultiPutCompletionCallback.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -2,6 +2,8 @@
 
 import java.util.Vector;
 
+import com.db4o.ObjectContainer;
+
 import freenet.client.InsertException;
 import freenet.client.Metadata;
 import freenet.keys.BaseClientKey;
@@ -34,19 +36,19 @@
 		finished = false;
 	}
 
-	public void onSuccess(ClientPutState state) {
-		onBlockSetFinished(state);
-		onFetchable(state);
+	public void onSuccess(ClientPutState state, ObjectContainer container) {
+		onBlockSetFinished(state, container);
+		onFetchable(state, container);
 		synchronized(this) {
 			if(finished) return;
 			waitingFor.remove(state);
 			if(!(waitingFor.isEmpty() && started))
 				return;
 		}
-		complete(null);
+		complete(null, container);
 	}
 
-	public void onFailure(InsertException e, ClientPutState state) {
+	public void onFailure(InsertException e, ClientPutState state, ObjectContainer container) {
 		synchronized(this) {
 			if(finished) return;
 			waitingFor.remove(state);
@@ -57,10 +59,10 @@
 				return;
 			}
 		}
-		complete(e);
+		complete(e, container);
 	}
 
-	private void complete(InsertException e) {
+	private void complete(InsertException e, ObjectContainer container) {
 		synchronized(this) {
 			if(finished) return;
 			finished = true;
@@ -71,9 +73,9 @@
 			if(e == null) e = this.e;
 		}
 		if(e != null)
-			cb.onFailure(e, this);
+			cb.onFailure(e, this, container);
 		else
-			cb.onSuccess(this);
+			cb.onSuccess(this, container);
 	}
 
 	public synchronized void addURIGenerator(ClientPutState ps) {
@@ -88,7 +90,7 @@
 		waitingForFetchable.add(ps);
 	}
 
-	public void arm() {
+	public void arm(ObjectContainer container) {
 		boolean allDone;
 		boolean allGotBlocks;
 		synchronized(this) {
@@ -98,10 +100,10 @@
 		}
 
 		if(allGotBlocks) {
-			cb.onBlockSetFinished(this);
+			cb.onBlockSetFinished(this, container);
 		}
 		if(allDone) {
-			complete(e);
+			complete(e, container);
 		}
 	}
 
@@ -109,23 +111,23 @@
 		return parent;
 	}
 
-	public void onEncode(BaseClientKey key, ClientPutState state) {
+	public void onEncode(BaseClientKey key, ClientPutState state, ObjectContainer container) {
 		synchronized(this) {
 			if(state != generator) return;
 		}
-		cb.onEncode(key, this);
+		cb.onEncode(key, this, container);
 	}
 
-	public void cancel() {
+	public void cancel(ObjectContainer container) {
 		ClientPutState[] states = new ClientPutState[waitingFor.size()];
 		synchronized(this) {
 			states = (ClientPutState[]) waitingFor.toArray(states);
 		}
 		for(int i=0;i<states.length;i++)
-			states[i].cancel();
+			states[i].cancel(container);
 	}
 
-	public synchronized void onTransition(ClientPutState oldState, ClientPutState newState) {
+	public synchronized void onTransition(ClientPutState oldState, ClientPutState newState, ObjectContainer container) {
 		if(generator == oldState)
 			generator = newState;
 		if(oldState == newState) return;
@@ -140,24 +142,24 @@
 		}
 	}
 
-	public synchronized void onMetadata(Metadata m, ClientPutState state) {
+	public synchronized void onMetadata(Metadata m, ClientPutState state, ObjectContainer container) {
 		if(generator == state) {
-			cb.onMetadata(m, this);
+			cb.onMetadata(m, this, container);
 		} else {
 			Logger.error(this, "Got metadata for "+state);
 		}
 	}
 
-	public void onBlockSetFinished(ClientPutState state) {
+	public void onBlockSetFinished(ClientPutState state, ObjectContainer container) {
 		synchronized(this) {
 			this.waitingForBlockSet.remove(state);
 			if(!started) return;
 			if(!waitingForBlockSet.isEmpty()) return;
 		}
-		cb.onBlockSetFinished(this);
+		cb.onBlockSetFinished(this, container);
 	}
 
-	public void schedule() throws InsertException {
+	public void schedule(ObjectContainer container, ClientContext context) throws InsertException {
 		// Do nothing
 	}
 
@@ -169,13 +171,13 @@
 		return null;
 	}
 
-	public void onFetchable(ClientPutState state) {
+	public void onFetchable(ClientPutState state, ObjectContainer container) {
 		synchronized(this) {
 			this.waitingForFetchable.remove(state);
 			if(!started) return;
 			if(!waitingForFetchable.isEmpty()) return;
 		}
-		cb.onFetchable(this);
+		cb.onFetchable(this, container);
 	}
 
 }

Modified: branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -12,6 +12,8 @@
 import java.util.zip.ZipException;
 import java.util.zip.ZipOutputStream;
 
+import com.db4o.ObjectContainer;
+
 import freenet.client.ClientMetadata;
 import freenet.client.DefaultMIMETypes;
 import freenet.client.InsertBlock;
@@ -33,7 +35,7 @@
 	private class PutHandler extends BaseClientPutter implements PutCompletionCallback {
 		
 		protected PutHandler(final SimpleManifestPutter smp, String name, Bucket data, ClientMetadata cm, boolean getCHKOnly) throws InsertException {
-			super(smp.priorityClass, smp.chkScheduler, smp.sskScheduler, smp.client);
+			super(smp.priorityClass, smp.client);
 			this.cm = cm;
 			this.data = data;
 			InsertBlock block = 
@@ -44,7 +46,7 @@
 		}
 
 		protected PutHandler(final SimpleManifestPutter smp, String name, FreenetURI target, ClientMetadata cm) {
-			super(smp.getPriorityClass(), smp.chkScheduler, smp.sskScheduler, smp.client);
+			super(smp.getPriorityClass(), smp.client);
 			this.cm = cm;
 			this.data = null;
 			Metadata m = new Metadata(Metadata.SIMPLE_REDIRECT, target, cm);
@@ -53,7 +55,7 @@
 		}
 		
 		protected PutHandler(final SimpleManifestPutter smp, String name, String targetInZip, ClientMetadata cm, Bucket data) {
-			super(smp.getPriorityClass(), smp.chkScheduler, smp.sskScheduler, smp.client);
+			super(smp.getPriorityClass(), smp.client);
 			this.cm = cm;
 			this.data = data;
 			this.targetInZip = targetInZip;
@@ -82,10 +84,10 @@
 			return SimpleManifestPutter.this.finished || cancelled || SimpleManifestPutter.this.cancelled;
 		}
 
-		public void onSuccess(ClientPutState state) {
+		public void onSuccess(ClientPutState state, ObjectContainer container) {
 			logMINOR = Logger.shouldLog(Logger.MINOR, this);
 			if(logMINOR) Logger.minor(this, "Completed "+this);
-			SimpleManifestPutter.this.onFetchable(this);
+			SimpleManifestPutter.this.onFetchable(this, container);
 			synchronized(SimpleManifestPutter.this) {
 				runningPutHandlers.remove(this);
 				if(!runningPutHandlers.isEmpty()) {
@@ -95,26 +97,26 @@
 			insertedAllFiles();
 		}
 
-		public void onFailure(InsertException e, ClientPutState state) {
+		public void onFailure(InsertException e, ClientPutState state, ObjectContainer container) {
 			logMINOR = Logger.shouldLog(Logger.MINOR, this);
 			if(logMINOR) Logger.minor(this, "Failed: "+this+" - "+e, e);
 			fail(e);
 		}
 
-		public void onEncode(BaseClientKey key, ClientPutState state) {
+		public void onEncode(BaseClientKey key, ClientPutState state, ObjectContainer container) {
 			if(logMINOR) Logger.minor(this, "onEncode("+key+") for "+this);
 			if(metadata == null) {
 				// The file was too small to have its own metadata, we get this instead.
 				// So we make the key into metadata.
 				Metadata m =
 					new Metadata(Metadata.SIMPLE_REDIRECT, key.getURI(), cm);
-				onMetadata(m, null);
+				onMetadata(m, null, container);
 			}
 		}
 
-		public void onTransition(ClientPutState oldState, ClientPutState newState) {}
+		public void onTransition(ClientPutState oldState, ClientPutState newState, ObjectContainer container) {}
 
-		public void onMetadata(Metadata m, ClientPutState state) {
+		public void onMetadata(Metadata m, ClientPutState state, ObjectContainer container) {
 			logMINOR = Logger.shouldLog(Logger.MINOR, this);
 			if(logMINOR) Logger.minor(this, "Assigning metadata: "+m+" for "+this+" from "+state,
 					new Exception("debug"));
@@ -158,7 +160,7 @@
 			// FIXME generate per-filename events???
 		}
 
-		public void onBlockSetFinished(ClientPutState state) {
+		public void onBlockSetFinished(ClientPutState state, ObjectContainer container) {
 			synchronized(SimpleManifestPutter.this) {
 				waitingForBlockSets.remove(this);
 				if(!waitingForBlockSets.isEmpty()) return;
@@ -170,11 +172,11 @@
 			SimpleManifestPutter.this.onMajorProgress();
 		}
 
-		public void onFetchable(ClientPutState state) {
-			SimpleManifestPutter.this.onFetchable(this);
+		public void onFetchable(ClientPutState state, ObjectContainer container) {
+			SimpleManifestPutter.this.onFetchable(this, container);
 		}
 
-		public void onTransition(ClientGetState oldState, ClientGetState newState) {
+		public void onTransition(ClientGetState oldState, ClientGetState newState, ObjectContainer container) {
 			// Ignore
 		}
 
@@ -212,7 +214,7 @@
 	public SimpleManifestPutter(ClientCallback cb, ClientRequestScheduler chkSched,
 			ClientRequestScheduler sskSched, HashMap manifestElements, short prioClass, FreenetURI target, 
 			String defaultName, InsertContext ctx, boolean getCHKOnly, RequestClient clientContext, boolean earlyEncode) throws InsertException {
-		super(prioClass, chkSched, sskSched, clientContext);
+		super(prioClass, clientContext);
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		this.defaultName = defaultName;
 		this.targetURI = target;
@@ -555,7 +557,7 @@
 		fail(new InsertException(InsertException.CANCELLED));
 	}
 	
-	public void onSuccess(ClientPutState state) {
+	public void onSuccess(ClientPutState state, ObjectContainer container) {
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		synchronized(this) {
 			metadataPuttersByMetadata.remove(state.getToken());
@@ -578,12 +580,12 @@
 		complete();
 	}
 	
-	public void onFailure(InsertException e, ClientPutState state) {
+	public void onFailure(InsertException e, ClientPutState state, ObjectContainer container) {
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		fail(e);
 	}
 	
-	public void onEncode(BaseClientKey key, ClientPutState state) {
+	public void onEncode(BaseClientKey key, ClientPutState state, ObjectContainer container) {
 		if(state.getToken() == baseMetadata) {
 			this.finalURI = key.getURI();
 			if(logMINOR) Logger.minor(this, "Got metadata key: "+finalURI);
@@ -597,13 +599,13 @@
 		}
 	}
 	
-	public void onTransition(ClientPutState oldState, ClientPutState newState) {
+	public void onTransition(ClientPutState oldState, ClientPutState newState, ObjectContainer container) {
 		synchronized(this) {
 			if(logMINOR) Logger.minor(this, "Transition: "+oldState+" -> "+newState);
 		}
 	}
 	
-	public void onMetadata(Metadata m, ClientPutState state) {
+	public void onMetadata(Metadata m, ClientPutState state, ObjectContainer container) {
 		// Ignore
 	}
 
@@ -611,7 +613,7 @@
 		ctx.eventProducer.produceEvent(new SplitfileProgressEvent(this.totalBlocks, this.successfulBlocks, this.failedBlocks, this.fatallyFailedBlocks, this.minSuccessBlocks, this.blockSetFinalized));
 	}
 
-	public void onBlockSetFinished(ClientPutState state) {
+	public void onBlockSetFinished(ClientPutState state, ObjectContainer container) {
 		synchronized(this) {
 			this.metadataBlockSetFinalized = true;
 			if(!waitingForBlockSets.isEmpty()) return;
@@ -717,7 +719,7 @@
 		cb.onMajorProgress();
 	}
 
-	protected void onFetchable(PutHandler handler) {
+	protected void onFetchable(PutHandler handler, ObjectContainer container) {
 		synchronized(this) {
 			putHandlersWaitingForFetchable.remove(handler);
 			if(fetchable) return;
@@ -729,7 +731,7 @@
 		cb.onFetchable(this);
 	}
 
-	public void onFetchable(ClientPutState state) {
+	public void onFetchable(ClientPutState state, ObjectContainer container) {
 		Metadata m = (Metadata) state.getToken();
 		synchronized(this) {
 			metadataPuttersUnfetchable.remove(m);
@@ -741,7 +743,7 @@
 		cb.onFetchable(this);
 	}
 
-	public void onTransition(ClientGetState oldState, ClientGetState newState) {
+	public void onTransition(ClientGetState oldState, ClientGetState newState, ObjectContainer container) {
 		// Ignore
 	}
 

Modified: branches/db4o/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SimpleSingleFileFetcher.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -43,47 +43,47 @@
 	final long token;
 	
 	// Translate it, then call the real onFailure
-	public void onFailure(LowLevelGetException e, Object reqTokenIgnored, RequestScheduler sched, ObjectContainer container) {
+	public void onFailure(LowLevelGetException e, Object reqTokenIgnored, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		switch(e.code) {
 		case LowLevelGetException.DATA_NOT_FOUND:
-			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), false, sched, container);
+			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), false, sched, container, context);
 			return;
 		case LowLevelGetException.DATA_NOT_FOUND_IN_STORE:
-			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), false, sched, container);
+			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), false, sched, container, context);
 			return;
 		case LowLevelGetException.RECENTLY_FAILED:
-			onFailure(new FetchException(FetchException.RECENTLY_FAILED), false, sched, container);
+			onFailure(new FetchException(FetchException.RECENTLY_FAILED), false, sched, container, context);
 			return;
 		case LowLevelGetException.DECODE_FAILED:
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), false, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), false, sched, container, context);
 			return;
 		case LowLevelGetException.INTERNAL_ERROR:
-			onFailure(new FetchException(FetchException.INTERNAL_ERROR), false, sched, container);
+			onFailure(new FetchException(FetchException.INTERNAL_ERROR), false, sched, container, context);
 			return;
 		case LowLevelGetException.REJECTED_OVERLOAD:
-			onFailure(new FetchException(FetchException.REJECTED_OVERLOAD), false, sched, container);
+			onFailure(new FetchException(FetchException.REJECTED_OVERLOAD), false, sched, container, context);
 			return;
 		case LowLevelGetException.ROUTE_NOT_FOUND:
-			onFailure(new FetchException(FetchException.ROUTE_NOT_FOUND), false, sched, container);
+			onFailure(new FetchException(FetchException.ROUTE_NOT_FOUND), false, sched, container, context);
 			return;
 		case LowLevelGetException.TRANSFER_FAILED:
-			onFailure(new FetchException(FetchException.TRANSFER_FAILED), false, sched, container);
+			onFailure(new FetchException(FetchException.TRANSFER_FAILED), false, sched, container, context);
 			return;
 		case LowLevelGetException.VERIFY_FAILED:
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), false, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), false, sched, container, context);
 			return;
 		case LowLevelGetException.CANCELLED:
-			onFailure(new FetchException(FetchException.CANCELLED), false, sched, container);
+			onFailure(new FetchException(FetchException.CANCELLED), false, sched, container, context);
 			return;
 		default:
 			Logger.error(this, "Unknown LowLevelGetException code: "+e.code);
-			onFailure(new FetchException(FetchException.INTERNAL_ERROR), false, sched, container);
+			onFailure(new FetchException(FetchException.INTERNAL_ERROR), false, sched, container, context);
 			return;
 		}
 	}
 
 	// Real onFailure
-	protected void onFailure(FetchException e, boolean forceFatal, RequestScheduler sched, ObjectContainer container) {
+	protected void onFailure(FetchException e, boolean forceFatal, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		if(logMINOR) Logger.minor(this, "onFailure( "+e+" , "+forceFatal+")", e);
 		if(parent.isCancelled() || cancelled) {
@@ -92,7 +92,7 @@
 			forceFatal = true;
 		}
 		if(!(e.isFatal() || forceFatal) ) {
-			if(retry(sched, container)) {
+			if(retry(sched, container, context)) {
 				if(logMINOR) Logger.minor(this, "Retrying");
 				return;
 			}
@@ -103,50 +103,50 @@
 			parent.fatallyFailedBlock();
 		else
 			parent.failedBlock();
-		rcb.onFailure(e, this, container);
+		rcb.onFailure(e, this, container, context);
 	}
 
 	/** Will be overridden by SingleFileFetcher */
-	protected void onSuccess(FetchResult data, RequestScheduler sched, ObjectContainer container) {
+	protected void onSuccess(FetchResult data, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		unregister(false);
 		if(parent.isCancelled()) {
 			data.asBucket().free();
-			onFailure(new FetchException(FetchException.CANCELLED), false, sched, container);
+			onFailure(new FetchException(FetchException.CANCELLED), false, sched, container, context);
 			return;
 		}
-		rcb.onSuccess(data, this, container);
+		rcb.onSuccess(data, this, container, context);
 	}
 
-	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object reqTokenIgnored, RequestScheduler sched, ObjectContainer container) {
+	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object reqTokenIgnored, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		if(parent instanceof ClientGetter)
-			((ClientGetter)parent).addKeyToBinaryBlob(block);
-		Bucket data = extract(block, sched, container);
+			((ClientGetter)parent).addKeyToBinaryBlob(block, container, context);
+		Bucket data = extract(block, sched, container, context);
 		if(data == null) return; // failed
 		if(!block.isMetadata()) {
-			onSuccess(new FetchResult((ClientMetadata)null, data), sched, container);
+			onSuccess(new FetchResult((ClientMetadata)null, data), sched, container, context);
 		} else {
-			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), false, sched, container);
+			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), false, sched, container, context);
 		}
 	}
 
 	/** Convert a ClientKeyBlock to a Bucket. If an error occurs, report it via onFailure
 	 * and return null.
 	 */
-	protected Bucket extract(ClientKeyBlock block, RequestScheduler sched, ObjectContainer container) {
+	protected Bucket extract(ClientKeyBlock block, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		Bucket data;
 		try {
 			data = block.decode(ctx.bucketFactory, (int)(Math.min(ctx.maxOutputLength, Integer.MAX_VALUE)), false);
 		} catch (KeyDecodeException e1) {
 			if(Logger.shouldLog(Logger.MINOR, this))
 				Logger.minor(this, "Decode failure: "+e1, e1);
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR, e1.getMessage()), false, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR, e1.getMessage()), false, sched, container, context);
 			return null;
 		} catch (TooBigException e) {
-			onFailure(new FetchException(FetchException.TOO_BIG, e), false, sched, container);
+			onFailure(new FetchException(FetchException.TOO_BIG, e), false, sched, container, context);
 			return null;
 		} catch (IOException e) {
 			Logger.error(this, "Could not capture data - disk full?: "+e, e);
-			onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container);
+			onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container, context);
 			return null;
 		}
 		return data;

Modified: branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SingleBlockInserter.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -141,7 +141,7 @@
 		return retries;
 	}
 
-	public void onFailure(LowLevelPutException e, Object keyNum, ObjectContainer container) {
+	public void onFailure(LowLevelPutException e, Object keyNum, ObjectContainer container, ClientContext context) {
 		if(parent.isCancelled()) {
 			fail(new InsertException(InsertException.CANCELLED), container);
 			return;
@@ -183,7 +183,7 @@
 			fail(InsertException.construct(errors), container);
 			return;
 		}
-		getScheduler().register(this);
+		getScheduler(context).register(this);
 	}
 
 	private void fail(InsertException e, ObjectContainer container) {

Modified: branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SingleFileFetcher.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -126,7 +126,7 @@
 	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		this.sched = sched;
 		if(parent instanceof ClientGetter)
-			((ClientGetter)parent).addKeyToBinaryBlob(block);
+			((ClientGetter)parent).addKeyToBinaryBlob(block, container, context);
 		parent.completedBlock(fromStore);
 		// Extract data
 		
@@ -134,7 +134,7 @@
 			Logger.error(this, "block is null! fromStore="+fromStore+", token="+token, new Exception("error"));
 			return;
 		}
-		Bucket data = extract(block, sched, container);
+		Bucket data = extract(block, sched, container, context);
 		if(data == null) {
 			if(logMINOR)
 				Logger.minor(this, "No data");
@@ -144,29 +144,29 @@
 		if(logMINOR)
 			Logger.minor(this, "Block "+(block.isMetadata() ? "is metadata" : "is not metadata")+" on "+this);
 		if(!block.isMetadata()) {
-			onSuccess(new FetchResult(clientMetadata, data), sched, container);
+			onSuccess(new FetchResult(clientMetadata, data), sched, container, context);
 		} else {
 			if(!ctx.followRedirects) {
-				onFailure(new FetchException(FetchException.INVALID_METADATA, "Told me not to follow redirects (splitfile block??)"), false, sched, container);
+				onFailure(new FetchException(FetchException.INVALID_METADATA, "Told me not to follow redirects (splitfile block??)"), false, sched, container, context);
 				return;
 			}
 			if(parent.isCancelled()) {
-				onFailure(new FetchException(FetchException.CANCELLED), false, sched, container);
+				onFailure(new FetchException(FetchException.CANCELLED), false, sched, container, context);
 				return;
 			}
 			if(data.size() > ctx.maxMetadataSize) {
-				onFailure(new FetchException(FetchException.TOO_BIG_METADATA), false, sched, container);
+				onFailure(new FetchException(FetchException.TOO_BIG_METADATA), false, sched, container, context);
 				return;
 			}
 			// Parse metadata
 			try {
 				metadata = Metadata.construct(data);
 			} catch (MetadataParseException e) {
-				onFailure(new FetchException(e), false, sched, container);
+				onFailure(new FetchException(e), false, sched, container, context);
 				return;
 			} catch (IOException e) {
 				// Bucket error?
-				onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container);
+				onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container, context);
 				return;
 			}
 			wrapHandleMetadata(false, container, context);
@@ -180,7 +180,7 @@
 			if(logMINOR)
 				Logger.minor(this, "Parent is cancelled");
 			result.asBucket().free();
-			onFailure(new FetchException(FetchException.CANCELLED), false, sched, container);
+			onFailure(new FetchException(FetchException.CANCELLED), false, sched, container, context);
 			return;
 		}
 		if(!decompressors.isEmpty()) {
@@ -191,10 +191,10 @@
 					long maxLen = Math.max(ctx.maxTempLength, ctx.maxOutputLength);
 					data = c.decompress(data, ctx.bucketFactory, maxLen, maxLen * 4, decompressors.isEmpty() ? returnBucket : null);
 				} catch (IOException e) {
-					onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container);
+					onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container, context);
 					return;
 				} catch (CompressionOutputSizeException e) {
-					onFailure(new FetchException(FetchException.TOO_BIG, e.estimatedSize, (rcb == parent), result.getMimeType()), false, sched, container);
+					onFailure(new FetchException(FetchException.TOO_BIG, e.estimatedSize, (rcb == parent), result.getMimeType()), false, sched, container, context);
 					return;
 				}
 			}
@@ -291,16 +291,16 @@
 								wrapHandleMetadata(true, container, context);
 							} catch (MetadataParseException e) {
 								// Invalid metadata
-								onFailure(new FetchException(FetchException.INVALID_METADATA, e), false, sched, container);
+								onFailure(new FetchException(FetchException.INVALID_METADATA, e), false, sched, container, context);
 								return;
 							} catch (IOException e) {
 								// Bucket error?
-								onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container);
+								onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container, context);
 								return;
 							}
 						}
 						public void notInArchive() {
-							onFailure(new FetchException(FetchException.INTERNAL_ERROR, "No metadata in container! Cannot happen as ArchiveManager should synthesise some!"), false, sched, container);
+							onFailure(new FetchException(FetchException.INTERNAL_ERROR, "No metadata in container! Cannot happen as ArchiveManager should synthesise some!"), false, sched, container, context);
 						}
 					}, container, context); // will result in this function being called again
 					return;
@@ -337,11 +337,7 @@
 						throw new FetchException(FetchException.BUCKET_ERROR);
 					}
 					// Return the data
-					ctx.executor.execute(new Runnable() {
-						public void run() {
-							onSuccess(new FetchResult(clientMetadata, out), sched, container);
-						}
-					}, "SingleFileFetcher onSuccess callback for "+this);
+					onSuccess(new FetchResult(clientMetadata, out), sched, container, context);
 					
 					return;
 				} else {
@@ -363,14 +359,14 @@
 									out = data;
 								}
 							} catch (IOException e) {
-								onFailure(new FetchException(FetchException.BUCKET_ERROR), false, sched, container);
+								onFailure(new FetchException(FetchException.BUCKET_ERROR), false, sched, container, context);
 								return;
 							}
 							// Return the data
-							onSuccess(new FetchResult(clientMetadata, out), sched, container);
+							onSuccess(new FetchResult(clientMetadata, out), sched, container, context);
 						}
 						public void notInArchive() {
-							onFailure(new FetchException(FetchException.NOT_IN_ARCHIVE), false, sched, container);
+							onFailure(new FetchException(FetchException.NOT_IN_ARCHIVE), false, sched, container, context);
 						}
 					}, container, context);
 					// Will call back into this function when it has been fetched.
@@ -576,15 +572,15 @@
 		try {
 			handleMetadata(container, context);
 		} catch (MetadataParseException e) {
-			onFailure(new FetchException(e), false, sched, container);
+			onFailure(new FetchException(e), false, sched, container, context);
 		} catch (FetchException e) {
 			if(notFinalizedSize)
 				e.setNotFinalizedSize();
-			onFailure(e, false, sched, container);
+			onFailure(e, false, sched, container, context);
 		} catch (ArchiveFailureException e) {
-			onFailure(new FetchException(e), false, sched, container);
+			onFailure(new FetchException(e), false, sched, container, context);
 		} catch (ArchiveRestartException e) {
-			onFailure(new FetchException(e), false, sched, container);
+			onFailure(new FetchException(e), false, sched, container, context);
 		}
 	}
 
@@ -604,10 +600,10 @@
 			try {
 				ah.extractToCache(result.asBucket(), actx, element, callback);
 			} catch (ArchiveFailureException e) {
-				SingleFileFetcher.this.onFailure(new FetchException(e), false, sched, container);
+				SingleFileFetcher.this.onFailure(new FetchException(e), false, sched, container, context);
 				return;
 			} catch (ArchiveRestartException e) {
-				SingleFileFetcher.this.onFailure(new FetchException(e), false, sched, container);
+				SingleFileFetcher.this.onFailure(new FetchException(e), false, sched, container, context);
 				return;
 			}
 			if(callback != null) return;
@@ -616,7 +612,7 @@
 
 		public void onFailure(FetchException e, ClientGetState state, ObjectContainer container, ClientContext context) {
 			// Force fatal as the fetcher is presumed to have made a reasonable effort.
-			SingleFileFetcher.this.onFailure(e, true, sched, container);
+			SingleFileFetcher.this.onFailure(e, true, sched, container, context);
 		}
 
 		public void onBlockSetFinished(ClientGetState state, ObjectContainer container) {
@@ -649,11 +645,11 @@
 			try {
 				metadata = Metadata.construct(result.asBucket());
 			} catch (MetadataParseException e) {
-				SingleFileFetcher.this.onFailure(new FetchException(FetchException.INVALID_METADATA, e), false, sched, container);
+				SingleFileFetcher.this.onFailure(new FetchException(FetchException.INVALID_METADATA, e), false, sched, container, context);
 				return;
 			} catch (IOException e) {
 				// Bucket error?
-				SingleFileFetcher.this.onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container);
+				SingleFileFetcher.this.onFailure(new FetchException(FetchException.BUCKET_ERROR, e), false, sched, container, context);
 				return;
 			}
 			wrapHandleMetadata(true, container, context);
@@ -661,7 +657,7 @@
 		
 		public void onFailure(FetchException e, ClientGetState state, ObjectContainer container, ClientContext context) {
 			// Pass it on; fetcher is assumed to have retried as appropriate already, so this is fatal.
-			SingleFileFetcher.this.onFailure(e, true, sched, container);
+			SingleFileFetcher.this.onFailure(e, true, sched, container, context);
 		}
 
 		public void onBlockSetFinished(ClientGetState state, ObjectContainer container) {

Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcher.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -221,7 +221,7 @@
 		return output;
 	}
 
-	public void segmentFinished(SplitFileFetcherSegment segment, ObjectContainer container) {
+	public void segmentFinished(SplitFileFetcherSegment segment, ObjectContainer container, ClientContext context) {
 		boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		if(logMINOR) Logger.minor(this, "Finished segment: "+segment);
 		boolean finish = false;
@@ -242,10 +242,10 @@
 			} 
 			notifyAll();
 		}
-		if(finish) finish(container);
+		if(finish) finish(container, context);
 	}
 
-	private void finish(ObjectContainer container) {
+	private void finish(ObjectContainer container, ClientContext context) {
 		try {
 			synchronized(this) {
 				if(finished) {
@@ -264,22 +264,22 @@
 					if(!decompressors.isEmpty()) out = null;
 					data = c.decompress(data, fetchContext.bucketFactory, maxLen, maxLen * 4, out);
 				} catch (IOException e) {
-					cb.onFailure(new FetchException(FetchException.BUCKET_ERROR, e), this, container);
+					cb.onFailure(new FetchException(FetchException.BUCKET_ERROR, e), this, container, context);
 					return;
 				} catch (CompressionOutputSizeException e) {
-					cb.onFailure(new FetchException(FetchException.TOO_BIG, e.estimatedSize, false /* FIXME */, clientMetadata.getMIMEType()), this, container);
+					cb.onFailure(new FetchException(FetchException.TOO_BIG, e.estimatedSize, false /* FIXME */, clientMetadata.getMIMEType()), this, container, context);
 					return;
 				}
 			}
-			cb.onSuccess(new FetchResult(clientMetadata, data), this, container);
+			cb.onSuccess(new FetchResult(clientMetadata, data), this, container, context);
 		} catch (FetchException e) {
-			cb.onFailure(e, this, container);
+			cb.onFailure(e, this, container, context);
 		} catch (OutOfMemoryError e) {
 			OOMHandler.handleOOM(e);
 			System.err.println("Failing above attempted fetch...");
-			cb.onFailure(new FetchException(FetchException.INTERNAL_ERROR, e), this, container);
+			cb.onFailure(new FetchException(FetchException.INTERNAL_ERROR, e), this, container, context);
 		} catch (Throwable t) {
-			cb.onFailure(new FetchException(FetchException.INTERNAL_ERROR, t), this, container);
+			cb.onFailure(new FetchException(FetchException.INTERNAL_ERROR, t), this, container, context);
 		}
 	}
 
@@ -290,9 +290,9 @@
 		}
 	}
 
-	public void cancel(ObjectContainer container) {
+	public void cancel(ObjectContainer container, ClientContext context) {
 		for(int i=0;i<segments.length;i++)
-			segments[i].cancel(container);
+			segments[i].cancel(container, context);
 	}
 
 	public long getToken() {

Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSegment.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -159,7 +159,7 @@
 		logMINOR = Logger.shouldLog(Logger.MINOR, this);
 		if(logMINOR) Logger.minor(this, "Fetched block "+blockNo+" on "+seg);
 		if(parentFetcher.parent instanceof ClientGetter)
-			((ClientGetter)parentFetcher.parent).addKeyToBinaryBlob(block);
+			((ClientGetter)parentFetcher.parent).addKeyToBinaryBlob(block, container, sched.getContext());
 		// No need to unregister key, because it will be cleared in tripPendingKey().
 		boolean dontNotify;
 		synchronized(this) {
@@ -213,7 +213,7 @@
 		
 		if(splitfileType != Metadata.SPLITFILE_NONREDUNDANT) {
 			FECQueue queue = sched.getFECQueue();
-			codec.addToQueue(new FECJob(codec, queue, dataBuckets, checkBuckets, CHKBlock.DATA_LENGTH, fetchContext.bucketFactory, this, true, parentFetcher.parent.getPriorityClass(), parentFetcher.parent.isPersistent()), 
+			codec.addToQueue(new FECJob(codec, queue, dataBuckets, checkBuckets, CHKBlock.DATA_LENGTH, fetchContext.bucketFactory, this, true, parentFetcher.parent.getPriorityClass(), parentFetcher.parent.persistent()), 
 					queue, container);
 			// Now have all the data blocks (not necessarily all the check blocks)
 		}
@@ -225,9 +225,9 @@
 				for(int i=0;i<dataBuckets.length;i++) {
 					Bucket data = dataBuckets[i].getData();
 					try {
-						maybeAddToBinaryBlob(data, i, false);
+						maybeAddToBinaryBlob(data, i, false, container, context);
 					} catch (FetchException e) {
-						fail(e, container);
+						fail(e, container, context);
 						return;
 					}
 				}
@@ -246,14 +246,14 @@
 			// Otherwise a race is possible that might result in it not seeing our finishing.
 			finished = true;
 			if(codec == null || !isCollectingBinaryBlob())
-				parentFetcher.segmentFinished(SplitFileFetcherSegment.this, container);
+				parentFetcher.segmentFinished(SplitFileFetcherSegment.this, container, context);
 		} catch (IOException e) {
 			Logger.normal(this, "Caught bucket error?: "+e, e);
 			synchronized(this) {
 				finished = true;
 				failureException = new FetchException(FetchException.BUCKET_ERROR);
 			}
-			parentFetcher.segmentFinished(SplitFileFetcherSegment.this, container);
+			parentFetcher.segmentFinished(SplitFileFetcherSegment.this, container, context);
 			return;
 		}
 
@@ -266,7 +266,7 @@
 
 		// Encode any check blocks we don't have
 		if(codec != null) {
-			codec.addToQueue(new FECJob(codec, context.fecQueue, dataBuckets, checkBuckets, 32768, fetchContext.bucketFactory, this, false, parentFetcher.parent.getPriorityClass(), parentFetcher.parent.isPersistent()),
+			codec.addToQueue(new FECJob(codec, context.fecQueue, dataBuckets, checkBuckets, 32768, fetchContext.bucketFactory, this, false, parentFetcher.parent.getPriorityClass(), parentFetcher.parent.persistent()),
 					context.fecQueue, container);
 		}
 	}
@@ -280,7 +280,7 @@
 				if(dataRetries[i] > 0)
 					heal = true;
 				if(heal) {
-					queueHeal(data);
+					queueHeal(data, context);
 				} else {
 					dataBuckets[i].data.free();
 					dataBuckets[i].data = null;
@@ -292,15 +292,15 @@
 				boolean heal = false;
 				Bucket data = checkBuckets[i].getData();
 				try {
-					maybeAddToBinaryBlob(data, i, true);
+					maybeAddToBinaryBlob(data, i, true, container, context);
 				} catch (FetchException e) {
-					fail(e, container);
+					fail(e, container, context);
 					return;
 				}
 				if(checkRetries[i] > 0)
 					heal = true;
 				if(heal) {
-					queueHeal(data);
+					queueHeal(data, context);
 				} else {
 					checkBuckets[i].data.free();
 				}
@@ -310,7 +310,7 @@
 		}
 		// Defer the completion until we have generated healing blocks if we are collecting binary blobs.
 		if(isCollectingBinaryBlob())
-			parentFetcher.segmentFinished(SplitFileFetcherSegment.this, container);
+			parentFetcher.segmentFinished(SplitFileFetcherSegment.this, container, context);
 	}
 
 	boolean isCollectingBinaryBlob() {
@@ -320,14 +320,14 @@
 		} else return false;
 	}
 	
-	private void maybeAddToBinaryBlob(Bucket data, int i, boolean check) throws FetchException {
+	private void maybeAddToBinaryBlob(Bucket data, int i, boolean check, ObjectContainer container, ClientContext context) throws FetchException {
 		if(parentFetcher.parent instanceof ClientGetter) {
 			ClientGetter getter = (ClientGetter) (parentFetcher.parent);
 			if(getter.collectingBinaryBlob()) {
 				try {
 					ClientCHKBlock block =
 						ClientCHKBlock.encode(data, false, true, (short)-1, data.size());
-					getter.addKeyToBinaryBlob(block);
+					getter.addKeyToBinaryBlob(block, container, context);
 				} catch (CHKEncodeException e) {
 					Logger.error(this, "Failed to encode (collecting binary blob) "+(check?"check":"data")+" block "+i+": "+e, e);
 					throw new FetchException(FetchException.INTERNAL_ERROR, "Failed to encode for binary blob: "+e);
@@ -338,9 +338,9 @@
 		}
 	}
 
-	private void queueHeal(Bucket data) {
+	private void queueHeal(Bucket data, ClientContext context) {
 		if(logMINOR) Logger.minor(this, "Queueing healing insert");
-		fetchContext.healingQueue.queue(data);
+		fetchContext.healingQueue.queue(data, context);
 	}
 	
 	/** This is after any retries and therefore is either out-of-retries or fatal 
@@ -380,7 +380,7 @@
 			allFailed = failedBlocks + fatallyFailedBlocks > (dataKeys.length + checkKeys.length - minFetched);
 		}
 		if(allFailed)
-			fail(new FetchException(FetchException.SPLITFILE_ERROR, errors), container);
+			fail(new FetchException(FetchException.SPLITFILE_ERROR, errors), container, context);
 		else
 			seg.possiblyRemoveFromParent();
 	}
@@ -463,7 +463,7 @@
 		return sub;
 	}
 
-	private void fail(FetchException e, ObjectContainer container) {
+	private void fail(FetchException e, ObjectContainer container, ClientContext context) {
 		synchronized(this) {
 			if(finished) return;
 			finished = true;
@@ -490,7 +490,7 @@
 			}
 		}
 		removeSubSegments();
-		parentFetcher.segmentFinished(this, container);
+		parentFetcher.segmentFinished(this, container, context);
 	}
 
 	public void schedule(ObjectContainer container, ClientContext context) {
@@ -508,12 +508,12 @@
 				Logger.minor(this, "scheduling "+seg+" : "+seg.blockNums);
 		} catch (Throwable t) {
 			Logger.error(this, "Caught "+t+" scheduling "+this, t);
-			fail(new FetchException(FetchException.INTERNAL_ERROR, t), container);
+			fail(new FetchException(FetchException.INTERNAL_ERROR, t), container, context);
 		}
 	}
 
-	public void cancel(ObjectContainer container) {
-		fail(new FetchException(FetchException.CANCELLED), container);
+	public void cancel(ObjectContainer container, ClientContext context) {
+		fail(new FetchException(FetchException.CANCELLED), container, context);
 	}
 
 	public void onBlockSetFinished(ClientGetState state) {

Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -167,49 +167,49 @@
 
 	// Translate it, then call the real onFailure
 	// FIXME refactor this out to a common method; see SimpleSingleFileFetcher
-	public void onFailure(LowLevelGetException e, Object token, RequestScheduler sched, ObjectContainer container) {
+	public void onFailure(LowLevelGetException e, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		if(logMINOR)
 			Logger.minor(this, "onFailure("+e+" , "+token);
 		switch(e.code) {
 		case LowLevelGetException.DATA_NOT_FOUND:
-			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), token, sched, container);
+			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), token, sched, container, context);
 			return;
 		case LowLevelGetException.DATA_NOT_FOUND_IN_STORE:
-			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), token, sched, container);
+			onFailure(new FetchException(FetchException.DATA_NOT_FOUND), token, sched, container, context);
 			return;
 		case LowLevelGetException.RECENTLY_FAILED:
-			onFailure(new FetchException(FetchException.RECENTLY_FAILED), token, sched, container);
+			onFailure(new FetchException(FetchException.RECENTLY_FAILED), token, sched, container, context);
 			return;
 		case LowLevelGetException.DECODE_FAILED:
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), token, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), token, sched, container, context);
 			return;
 		case LowLevelGetException.INTERNAL_ERROR:
-			onFailure(new FetchException(FetchException.INTERNAL_ERROR), token, sched, container);
+			onFailure(new FetchException(FetchException.INTERNAL_ERROR), token, sched, container, context);
 			return;
 		case LowLevelGetException.REJECTED_OVERLOAD:
-			onFailure(new FetchException(FetchException.REJECTED_OVERLOAD), token, sched, container);
+			onFailure(new FetchException(FetchException.REJECTED_OVERLOAD), token, sched, container, context);
 			return;
 		case LowLevelGetException.ROUTE_NOT_FOUND:
-			onFailure(new FetchException(FetchException.ROUTE_NOT_FOUND), token, sched, container);
+			onFailure(new FetchException(FetchException.ROUTE_NOT_FOUND), token, sched, container, context);
 			return;
 		case LowLevelGetException.TRANSFER_FAILED:
-			onFailure(new FetchException(FetchException.TRANSFER_FAILED), token, sched, container);
+			onFailure(new FetchException(FetchException.TRANSFER_FAILED), token, sched, container, context);
 			return;
 		case LowLevelGetException.VERIFY_FAILED:
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), token, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR), token, sched, container, context);
 			return;
 		case LowLevelGetException.CANCELLED:
-			onFailure(new FetchException(FetchException.CANCELLED), token, sched, container);
+			onFailure(new FetchException(FetchException.CANCELLED), token, sched, container, context);
 			return;
 		default:
 			Logger.error(this, "Unknown LowLevelGetException code: "+e.code);
-			onFailure(new FetchException(FetchException.INTERNAL_ERROR), token, sched, container);
+			onFailure(new FetchException(FetchException.INTERNAL_ERROR), token, sched, container, context);
 			return;
 		}
 	}
 
 	// Real onFailure
-	protected void onFailure(FetchException e, Object token, RequestScheduler sched, ObjectContainer container) {
+	protected void onFailure(FetchException e, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		boolean forceFatal = false;
 		if(parent.isCancelled()) {
 			if(Logger.shouldLog(Logger.MINOR, this)) 
@@ -219,13 +219,13 @@
 		}
 		segment.errors.inc(e.getMode());
 		if(e.isFatal() || forceFatal) {
-			segment.onFatalFailure(e, ((Integer)token).intValue(), this, container);
+			segment.onFatalFailure(e, ((Integer)token).intValue(), this, container, context);
 		} else {
 			segment.onNonFatalFailure(e, ((Integer)token).intValue(), this, sched, container);
 		}
 	}
 	
-	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container) {
+	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		Bucket data = extract(block, token, sched, container);
 		if(fromStore) {
 			// Normally when this method is called the block number has already
@@ -246,14 +246,14 @@
 		if(!block.isMetadata()) {
 			onSuccess(data, fromStore, (Integer)token, ((Integer)token).intValue(), block, sched, container);
 		} else {
-			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), token, sched, container);
+			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), token, sched, container, context);
 		}
 	}
 	
 	protected void onSuccess(Bucket data, boolean fromStore, Integer token, int blockNo, ClientKeyBlock block, RequestScheduler sched, ObjectContainer container) {
 		if(parent.isCancelled()) {
 			data.free();
-			onFailure(new FetchException(FetchException.CANCELLED), token, sched, container);
+			onFailure(new FetchException(FetchException.CANCELLED), token, sched, container, sched.getContext());
 			return;
 		}
 		segment.onSuccess(data, blockNo, this, block, container, sched);
@@ -263,20 +263,21 @@
 	 * and return null.
 	 */
 	protected Bucket extract(ClientKeyBlock block, Object token, RequestScheduler sched, ObjectContainer container) {
+		ClientContext context = sched.getContext();
 		Bucket data;
 		try {
 			data = block.decode(ctx.bucketFactory, (int)(Math.min(ctx.maxOutputLength, Integer.MAX_VALUE)), false);
 		} catch (KeyDecodeException e1) {
 			if(Logger.shouldLog(Logger.MINOR, this))
 				Logger.minor(this, "Decode failure: "+e1, e1);
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR, e1.getMessage()), token, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR, e1.getMessage()), token, sched, container, context);
 			return null;
 		} catch (TooBigException e) {
-			onFailure(new FetchException(FetchException.TOO_BIG, e.getMessage()), token, sched, container);
+			onFailure(new FetchException(FetchException.TOO_BIG, e.getMessage()), token, sched, container, context);
 			return null;
 		} catch (IOException e) {
 			Logger.error(this, "Could not capture data - disk full?: "+e, e);
-			onFailure(new FetchException(FetchException.BUCKET_ERROR, e), token, sched, container);
+			onFailure(new FetchException(FetchException.BUCKET_ERROR, e), token, sched, container, context);
 			return null;
 		}
 		if(Logger.shouldLog(Logger.MINOR, this))
@@ -382,7 +383,7 @@
 		unregister(false);
 	}
 
-	public void onGotKey(Key key, KeyBlock block, RequestScheduler sched, ObjectContainer container) {
+	public void onGotKey(Key key, KeyBlock block, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		if(logMINOR) Logger.minor(this, "onGotKey("+key+")");
 		// Find and remove block if it is on this subsegment. However it may have been
 		// removed already.
@@ -409,7 +410,7 @@
 		try {
 			cb = new ClientCHKBlock((CHKBlock)block, ckey);
 		} catch (CHKVerifyException e) {
-			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR, e), token, sched, container);
+			onFailure(new FetchException(FetchException.BLOCK_DECODE_ERROR, e), token, sched, container, context);
 			return;
 		}
 		Bucket data = extract(cb, token, sched, container);
@@ -417,7 +418,7 @@
 		if(!cb.isMetadata()) {
 			onSuccess(data, false, (Integer)token, ((Integer)token).intValue(), cb, sched, container);
 		} else {
-			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), token, sched, container);
+			onFailure(new FetchException(FetchException.INVALID_METADATA, "Metadata where expected data"), token, sched, container, context);
 		}
 		
 	}

Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -230,9 +230,9 @@
 		return (SplitFileInserterSegment[]) segs.toArray(new SplitFileInserterSegment[segs.size()]);
 	}
 	
-	public void start(ObjectContainer container) throws InsertException {
+	public void start(ObjectContainer container, ClientContext context) throws InsertException {
 		for(int i=0;i<segments.length;i++)
-			segments[i].start(container);
+			segments[i].start(container, context);
 		
 		if(countDataBlocks > 32)
 			parent.onMajorProgress();
@@ -240,7 +240,7 @@
 		
 	}
 
-	public void encodedSegment(SplitFileInserterSegment segment) {
+	public void encodedSegment(SplitFileInserterSegment segment, ObjectContainer container) {
 		if(logMINOR) Logger.minor(this, "Encoded segment "+segment.segNo+" of "+this);
 		boolean ret = false;
 		boolean encode;
@@ -255,12 +255,12 @@
 		}
 		if(encode) segment.forceEncode();
 		if(ret) return;
-		cb.onBlockSetFinished(this);
+		cb.onBlockSetFinished(this, container);
 		if(countDataBlocks > 32)
 			parent.onMajorProgress();
 	}
 	
-	public void segmentHasURIs(SplitFileInserterSegment segment) {
+	public void segmentHasURIs(SplitFileInserterSegment segment, ObjectContainer container) {
 		if(logMINOR) Logger.minor(this, "Segment has URIs: "+segment);
 		synchronized(this) {
 			if(haveSentMetadata) {
@@ -276,10 +276,10 @@
 		}
 		
 		if(logMINOR) Logger.minor(this, "Have URIs from all segments");
-		encodeMetadata();
+		encodeMetadata(container);
 	}
 	
-	private void encodeMetadata() {
+	private void encodeMetadata(ObjectContainer container) {
 		boolean missingURIs;
 		Metadata m = null;
 		synchronized(this) {
@@ -300,18 +300,18 @@
 		if(missingURIs) {
 			if(logMINOR) Logger.minor(this, "Missing URIs");
 			// Error
-			fail(new InsertException(InsertException.INTERNAL_ERROR, "Missing URIs after encoding", null));
+			fail(new InsertException(InsertException.INTERNAL_ERROR, "Missing URIs after encoding", null), container);
 			return;
 		} else
-			cb.onMetadata(m, this);
+			cb.onMetadata(m, this, container);
 	}
 	
-	private void fail(InsertException e) {
+	private void fail(InsertException e, ObjectContainer container) {
 		synchronized(this) {
 			if(finished) return;
 			finished = true;
 		}
-		cb.onFailure(e, this);
+		cb.onFailure(e, this, container);
 	}
 
 	// FIXME move this to somewhere
@@ -387,10 +387,10 @@
 			}
 			finished = true;
 		}
-		onAllFinished();
+		onAllFinished(container);
 	}
 	
-	public void segmentFetchable(SplitFileInserterSegment segment) {
+	public void segmentFetchable(SplitFileInserterSegment segment, ObjectContainer container) {
 		if(logMINOR) Logger.minor(this, "Segment fetchable: "+segment);
 		synchronized(this) {
 			if(finished) return;
@@ -403,10 +403,10 @@
 			}
 			fetchable = true;
 		}
-		cb.onFetchable(this);
+		cb.onFetchable(this, container);
 	}
 
-	private void onAllFinished() {
+	private void onAllFinished(ObjectContainer container) {
 		if(logMINOR) Logger.minor(this, "All finished");
 		try {
 			// Finished !!
@@ -422,14 +422,14 @@
 				tracker.inc(e.getMode());
 			}
 			if(allSucceeded)
-				cb.onSuccess(this);
+				cb.onSuccess(this, container);
 			else {
-				cb.onFailure(InsertException.construct(tracker), this);
+				cb.onFailure(InsertException.construct(tracker), this, container);
 			}
 		} catch (Throwable t) {
 			// We MUST tell the parent *something*!
 			Logger.error(this, "Caught "+t, t);
-			cb.onFailure(new InsertException(InsertException.INTERNAL_ERROR), this);
+			cb.onFailure(new InsertException(InsertException.INTERNAL_ERROR), this, container);
 		}
 	}
 
@@ -439,11 +439,11 @@
 			finished = true;
 		}
 		for(int i=0;i<segments.length;i++)
-			segments[i].cancel();
+			segments[i].cancel(container);
 	}
 
-	public void schedule(ObjectContainer container) throws InsertException {
-		start(container);
+	public void schedule(ObjectContainer container, ClientContext context) throws InsertException {
+		start(container, context);
 	}
 
 	public Object getToken() {

Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -395,7 +395,7 @@
 		return fs;
 	}
 
-	public void start(ObjectContainer container) throws InsertException {
+	public void start(ObjectContainer container, ClientContext context) throws InsertException {
 		if (logMINOR)
 			Logger.minor(this, "Starting segment " + segNo + " of " + parent
 					+ " (" + parent.dataLength + "): " + this + " ( finished="
@@ -409,7 +409,7 @@
 						dataBlocks[i], (short) -1, FreenetURI.EMPTY_CHK_URI,
 						blockInsertContext, this, false, CHKBlock.DATA_LENGTH,
 						i, getCHKOnly, false, false, parent.token);
-				dataBlockInserters[i].schedule();
+				dataBlockInserters[i].schedule(container, context);
 				fin = false;
 			} else {
 				parent.parent.completedBlock(true);
@@ -428,7 +428,7 @@
 				// Encode blocks
 				synchronized(this) {
 					if(!encoded){
-						splitfileAlgo.addToQueue(new FECJob(splitfileAlgo, dataBlocks, checkBlocks, CHKBlock.DATA_LENGTH, blockInsertContext.persistentBucketFactory, this, false));
+						splitfileAlgo.addToQueue(new FECJob(splitfileAlgo, context.fecQueue, dataBlocks, checkBlocks, CHKBlock.DATA_LENGTH, blockInsertContext.persistentBucketFactory, this, false, parent.parent.getPriorityClass(), parent.parent.persistent()), context.fecQueue, container);
 					}
 				}				
 				fin = false;
@@ -441,24 +441,24 @@
 							FreenetURI.EMPTY_CHK_URI, blockInsertContext, this,
 							false, CHKBlock.DATA_LENGTH, i + dataBlocks.length,
 							getCHKOnly, false, false, parent.token);
-					checkBlockInserters[i].schedule();
+					checkBlockInserters[i].schedule(container, context);
 					fin = false;
 				} else
 					parent.parent.completedBlock(true);
 			}
-			onEncodedSegment(container);
+			onEncodedSegment(container, context);
 		}
 		if (hasURIs) {
-			parent.segmentHasURIs(this);
+			parent.segmentHasURIs(this, container);
 		}
 		boolean fetchable;
 		synchronized (this) {
 			fetchable = (blocksCompleted > dataBlocks.length);
 		}
 		if (fetchable)
-			parent.segmentFetchable(this);
+			parent.segmentFetchable(this, container);
 		if (fin)
-			finish();
+			finish(container);
 		if (finished) {
 			parent.segmentFinished(this, container);
 		}
@@ -477,13 +477,13 @@
 						blockInsertContext, this, false, CHKBlock.DATA_LENGTH,
 						i + dataBlocks.length, getCHKOnly, false, false,
 						parent.token);
-				checkBlockInserters[i].schedule(container);
+				checkBlockInserters[i].schedule(container, context);
 			}
 		} catch (Throwable t) {
 			Logger.error(this, "Caught " + t + " while encoding " + this, t);
 			InsertException ex = new InsertException(
 					InsertException.INTERNAL_ERROR, t, null);
-			finish(ex);
+			finish(ex, container);
 			return;
 		}
 
@@ -493,7 +493,7 @@
 
 		// Tell parent only after have started the inserts.
 		// Because of the counting.
-		parent.encodedSegment(this);
+		parent.encodedSegment(this, container);
 
 		synchronized (this) {
 			for (int i = 0; i < dataBlockInserters.length; i++) {
@@ -505,7 +505,7 @@
 		}
 	}
 
-	private void finish(InsertException ex) {
+	private void finish(InsertException ex, ObjectContainer container) {
 		if (logMINOR)
 			Logger.minor(this, "Finishing " + this + " with " + ex, ex);
 		synchronized (this) {
@@ -514,20 +514,20 @@
 			finished = true;
 			toThrow = ex;
 		}
-		parent.segmentFinished(this);
+		parent.segmentFinished(this, container);
 	}
 
-	private void finish() {
+	private void finish(ObjectContainer container) {
 		synchronized (this) {
 			if (finished)
 				return;
 			finished = true;
 			toThrow = InsertException.construct(errors);
 		}
-		parent.segmentFinished(this);
+		parent.segmentFinished(this, container);
 	}
 
-	public void onEncode(BaseClientKey k, ClientPutState state) {
+	public void onEncode(BaseClientKey k, ClientPutState state, ObjectContainer container) {
 		ClientCHK key = (ClientCHK) k;
 		SingleBlockInserter sbi = (SingleBlockInserter) state;
 		int x = sbi.token;
@@ -563,40 +563,40 @@
 			}
 			hasURIs = true;
 		}
-		parent.segmentHasURIs(this);
+		parent.segmentHasURIs(this, container);
 	}
 
-	public void onSuccess(ClientPutState state) {
+	public void onSuccess(ClientPutState state, ObjectContainer container) {
 		if (parent.parent.isCancelled()) {
-			parent.cancel();
+			parent.cancel(container);
 			return;
 		}
 		SingleBlockInserter sbi = (SingleBlockInserter) state;
 		int x = sbi.token;
-		completed(x);
+		completed(x, container);
 	}
 
-	public void onFailure(InsertException e, ClientPutState state) {
+	public void onFailure(InsertException e, ClientPutState state, ObjectContainer container) {
 		if (parent.parent.isCancelled()) {
-			parent.cancel();
+			parent.cancel(container);
 			return;
 		}
 		SingleBlockInserter sbi = (SingleBlockInserter) state;
 		int x = sbi.token;
 		errors.merge(e);
-		completed(x);
+		completed(x, container);
 	}
 
-	private void completed(int x) {
+	private void completed(int x, ObjectContainer container) {
 		int total = innerCompleted(x);
 		if (total == -1)
 			return;
 		if (total == dataBlockInserters.length) {
-			parent.segmentFetchable(this);
+			parent.segmentFetchable(this, container);
 		}
 		if (total != dataBlockInserters.length + checkBlockInserters.length)
 			return;
-		finish();
+		finish(container);
 	}
 
 	/**
@@ -671,7 +671,7 @@
 		}
 	}
 
-	public void cancel() {
+	public void cancel(ObjectContainer container) {
 		synchronized (this) {
 			if (finished)
 				return;
@@ -682,7 +682,7 @@
 		for (int i = 0; i < dataBlockInserters.length; i++) {
 			SingleBlockInserter sbi = dataBlockInserters[i];
 			if (sbi != null)
-				sbi.cancel();
+				sbi.cancel(container);
 			Bucket d = dataBlocks[i];
 			if (d != null) {
 				d.free();
@@ -692,26 +692,26 @@
 		for (int i = 0; i < checkBlockInserters.length; i++) {
 			SingleBlockInserter sbi = checkBlockInserters[i];
 			if (sbi != null)
-				sbi.cancel();
+				sbi.cancel(container);
 			Bucket d = checkBlocks[i];
 			if (d != null) {
 				d.free();
 				checkBlocks[i] = null;
 			}
 		}
-		parent.segmentFinished(this);
+		parent.segmentFinished(this, container);
 	}
 
-	public void onTransition(ClientPutState oldState, ClientPutState newState) {
+	public void onTransition(ClientPutState oldState, ClientPutState newState, ObjectContainer container) {
 		Logger.error(this, "Illegal transition in SplitFileInserterSegment: "
 				+ oldState + " -> " + newState);
 	}
 
-	public void onMetadata(Metadata m, ClientPutState state) {
+	public void onMetadata(Metadata m, ClientPutState state, ObjectContainer container) {
 		Logger.error(this, "Got onMetadata from " + state);
 	}
 
-	public void onBlockSetFinished(ClientPutState state) {
+	public void onBlockSetFinished(ClientPutState state, ObjectContainer container) {
 		// Ignore
 		Logger.error(this, "Should not happen: onBlockSetFinished(" + state
 				+ ") on " + this);
@@ -725,7 +725,7 @@
 		return blocksCompleted >= dataBlocks.length;
 	}
 
-	public void onFetchable(ClientPutState state) {
+	public void onFetchable(ClientPutState state, ObjectContainer container) {
 		// Ignore
 	}
 

Modified: branches/db4o/freenet/src/freenet/client/async/USKChecker.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/USKChecker.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/USKChecker.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -28,12 +28,12 @@
 		this.cb = cb;
 	}
 	
-	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container) {
+	public void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context) {
 		unregister(false);
 		cb.onSuccess((ClientSSKBlock)block);
 	}
 
-	public void onFailure(LowLevelGetException e, Object token, RequestScheduler sched, ObjectContainer container) {
+	public void onFailure(LowLevelGetException e, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context) {
         if(Logger.shouldLog(Logger.MINOR, this))
         	Logger.minor(this, "onFailure: "+e+" for "+this);
 		// Firstly, can we retry?
@@ -63,7 +63,7 @@
 			canRetry = true;
 		}
 
-		if(canRetry && retry(sched, container)) return;
+		if(canRetry && retry(sched, container, context)) return;
 		
 		// Ran out of retries.
 		unregister(false);

Modified: branches/db4o/freenet/src/freenet/client/async/USKFetcherWrapper.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/USKFetcherWrapper.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/client/async/USKFetcherWrapper.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -19,7 +19,7 @@
 	final USK usk;
 	
 	public USKFetcherWrapper(USK usk, short prio, ClientRequestScheduler chkScheduler, ClientRequestScheduler sskScheduler, RequestClient client) {
-		super(prio, chkScheduler, sskScheduler, client);
+		super(prio, client);
 		this.usk = usk;
 	}
 
@@ -35,11 +35,11 @@
 		// Do nothing
 	}
 
-	public void onSuccess(FetchResult result, ClientGetState state, ObjectContainer container) {
+	public void onSuccess(FetchResult result, ClientGetState state, ObjectContainer container, ClientContext context) {
 		// Ignore; we don't do anything with it because we are running in the background.
 	}
 
-	public void onFailure(FetchException e, ClientGetState state, ObjectContainer container) {
+	public void onFailure(FetchException e, ClientGetState state, ObjectContainer container, ClientContext context) {
 		// Ignore
 	}
 

Modified: branches/db4o/freenet/src/freenet/node/SendableGet.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/SendableGet.java	2008-06-05 21:47:52 UTC (rev 20230)
+++ branches/db4o/freenet/src/freenet/node/SendableGet.java	2008-06-05 22:24:48 UTC (rev 20231)
@@ -40,10 +40,10 @@
 	public abstract FetchContext getContext();
 	
 	/** Called when/if the low-level request succeeds. */
-	public abstract void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container);
+	public abstract void onSuccess(ClientKeyBlock block, boolean fromStore, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context);
 	
 	/** Called when/if the low-level request fails. */
-	public abstract void onFailure(LowLevelGetException e, Object token, RequestScheduler sched, ObjectContainer container);
+	public abstract void onFailure(LowLevelGetException e, Object token, RequestScheduler sched, ObjectContainer container, ClientContext context);
 	
 	/** Should the request ignore the datastore? */
 	public abstract boolean ignoreStore();
@@ -116,7 +116,7 @@
 	 * @param block
 	 * @param sched
 	 */
-	public abstract void onGotKey(Key key, KeyBlock block, RequestScheduler sched, ObjectContainer container);
+	public abstract void onGotKey(Key key, KeyBlock block, RequestScheduler sched, ObjectContainer container, ClientContext context);
 	
 	/**
 	 * Get the time at which the key specified by the given token will wake up from the 




More information about the cvs mailing list