Use thread pool instead of new threads on Android. Closes #3690

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
pacamara
2018-04-17 15:23:49 +02:00
committed by Pedro Pombeiro
parent a521cc7039
commit ef8d5dca6c
4 changed files with 65 additions and 26 deletions
@@ -27,6 +27,7 @@ import com.testfairy.TestFairy;
import com.instabug.library.Instabug;
import java.util.Properties;
import im.status.ethereum.module.StatusThreadPoolExecutor;
public class MainActivity extends ReactActivity
implements ActivityCompat.OnRequestPermissionsResultCallback{
@@ -40,6 +41,7 @@ public class MainActivity extends ReactActivity
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(final Thread thread, final Throwable t) {
// High priority, so don't use StatusThreadPoolExecutor
new Thread() {
@Override
public void run() {
@@ -150,14 +152,14 @@ public class MainActivity extends ReactActivity
dialog.show();
}
Thread thread = new Thread() {
Runnable r = new Runnable() {
@Override
public void run() {
System.loadLibrary("status-logs");
}
};
thread.start();
StatusThreadPoolExecutor.getInstance().execute(r);
}
@Override