Browse Source

Add Android fs thread

Ben Hsieh 8 years ago
parent
commit
cf93077d26
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

+ 3
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java View File

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