[Android] Keep threads alive for 30 seconds

Geoffrey Métais git at videolan.org
Tue Apr 11 15:08:59 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 11 15:06:58 2017 +0200| [a359b84f4f57e1e45f9bf848ffed723043d82d65] | committer: Geoffrey Métais

Keep threads alive for 30 seconds

> https://code.videolan.org/videolan/vlc-android/commit/a359b84f4f57e1e45f9bf848ffed723043d82d65
---

 vlc-android/src/org/videolan/vlc/VLCApplication.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 7a699e4..3b2a916 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -68,9 +68,7 @@ public class VLCApplication extends Application {
     private static SimpleArrayMap<String, Object> sDataMap = new SimpleArrayMap<>();
 
     /* Up to 2 threads maximum, inactive threads are killed after 2 seconds */
-    int maxThreads = Math.max(AndroidUtil.isJellyBeanMR1OrLater ? Runtime.getRuntime().availableProcessors() : 2, 1);
-    private ThreadPoolExecutor mThreadPool = new ThreadPoolExecutor(Math.min(2, maxThreads), maxThreads, 2, TimeUnit.SECONDS,
-            new LinkedBlockingQueue<Runnable>(), THREAD_FACTORY);
+    private final int maxThreads = Math.max(AndroidUtil.isJellyBeanMR1OrLater ? Runtime.getRuntime().availableProcessors() : 2, 1);
     public static final ThreadFactory THREAD_FACTORY = new ThreadFactory() {
         @Override
         public Thread newThread(Runnable runnable) {
@@ -79,6 +77,8 @@ public class VLCApplication extends Application {
             return thread;
         }
     };
+    private final ThreadPoolExecutor mThreadPool = new ThreadPoolExecutor(Math.min(2, maxThreads), maxThreads, 30, TimeUnit.SECONDS,
+            new LinkedBlockingQueue<Runnable>(), THREAD_FACTORY);
     private Handler mHandler = new Handler(Looper.getMainLooper());
 
     private static int sDialogCounter = 0;



More information about the Android mailing list