Author: toad
Date: 2008-08-02 00:42:31 +0000 (Sat, 02 Aug 2008)
New Revision: 21572

Modified:
   trunk/freenet/src/freenet/client/HighLevelSimpleClient.java
   trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
Log:
Add a non-blocking fetch for those plugins that need it.

Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClient.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClient.java 2008-08-01 
23:52:20 UTC (rev 21571)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClient.java 2008-08-02 
00:42:31 UTC (rev 21572)
@@ -6,6 +6,7 @@
 import java.util.HashMap;
 import java.util.Set;

+import freenet.client.async.ClientCallback;
 import freenet.client.events.ClientEventListener;
 import freenet.keys.FreenetURI;

@@ -38,6 +39,11 @@
        public FetchResult fetch(FreenetURI uri, long maxSize, Object context) 
throws FetchException;

        /**
+        * Non-blocking fetch of a URI with a configurable max-size, context 
object, callback and context.
+        */
+       public void fetch(FreenetURI uri, long maxSize, Object context, 
ClientCallback callback, FetchContext fctx) throws FetchException;
+       
+       /**
         * Blocking insert.
         * @param filenameHint If set, insert a single-file manifest containing 
only this file, under the given filename.
         * @throws InsertException If there is an error inserting the data

Modified: trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java
===================================================================
--- trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2008-08-01 23:52:20 UTC (rev 21571)
+++ trunk/freenet/src/freenet/client/HighLevelSimpleClientImpl.java     
2008-08-02 00:42:31 UTC (rev 21572)
@@ -136,6 +136,12 @@
                return fw.waitForCompletion();
        }

+       public void fetch(FreenetURI uri, long maxSize, Object context, 
ClientCallback callback, FetchContext fctx) throws FetchException {
+               if(uri == null) throw new NullPointerException();
+               ClientGetter get = new ClientGetter(callback, 
core.requestStarters.chkFetchScheduler, core.requestStarters.sskFetchScheduler, 
uri, fctx, priorityClass, this, null, null);
+               get.start();
+       }
+       
        public FreenetURI insert(InsertBlock insert, boolean getCHKOnly, String 
filenameHint) throws InsertException {
                return insert(insert, getCHKOnly, filenameHint, false);
        }


Reply via email to