Improve locking and performance on asynchronous contact loading.

This commit is contained in:
Moxie Marlinspike
2013-01-06 15:46:26 -08:00
parent 25f75cb3d2
commit 2204584d8f
7 changed files with 76 additions and 50 deletions

View File

@@ -67,7 +67,17 @@ public class Util {
}
public static ExecutorService newSingleThreadedLifoExecutor() {
return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingLifoQueue<Runnable>());
ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingLifoQueue<Runnable>());
executor.execute(new Runnable() {
@Override
public void run() {
// Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
}
});
return executor;
}
// public static Bitmap loadScaledBitmap(InputStream src, int targetWidth, int targetHeight) {