Bläddra i källkod

Add Android fs thread

Ben Hsieh 8 år sedan
förälder
incheckning
cf93077d26
1 ändrade filer med 3 tillägg och 1 borttagningar
  1. 3
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

+ 3
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java Visa fil

@@ -21,6 +21,8 @@ public class RNFetchBlob extends ReactContextBaseJavaModule {
21 21
     static ReactApplicationContext RCTContext;
22 22
     static LinkedBlockingQueue<Runnable> taskQueue = new LinkedBlockingQueue<>();
23 23
     static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(5, 10, 5000, TimeUnit.MILLISECONDS, taskQueue);
24
+    static LinkedBlockingQueue<Runnable> fsTaskQueue = new LinkedBlockingQueue<>();
25
+    static ThreadPoolExecutor fsThreadPool = new ThreadPoolExecutor(2, 10, 5000, TimeUnit.MILLISECONDS, taskQueue);
24 26
 
25 27
     public RNFetchBlob(ReactApplicationContext reactContext) {
26 28
 
@@ -209,7 +211,7 @@ public class RNFetchBlob extends ReactContextBaseJavaModule {
209 211
      */
210 212
     public void readStream(final String path, final String encoding, final int bufferSize, final int tick, final String streamId) {
211 213
         final ReactApplicationContext ctx = this.getReactApplicationContext();
212
-        threadPool.execute(new Runnable() {
214
+        fsThreadPool.execute(new Runnable() {
213 215
             @Override
214 216
             public void run() {
215 217
                 RNFetchBlobFS fs = new RNFetchBlobFS(ctx);