Untitled
unknown
plain_text
2 years ago
595 B
16
Indexable
public static class HighPriorityThreadFactory implements ThreadFactory {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setPriority(Thread.MAX_PRIORITY);
return thread;
}
}
public static final Executor HIGH_PRIORITY_EXECUTOR = new ThreadPoolExecutor(
5, 128, 1, TimeUnit.SECONDS, null, new HighPriorityThreadFactory());
// Execute AsyncTask using high priority executor
public void executeHighPriority() {
executeOnExecutor(HIGH_PRIORITY_EXECUTOR);
}Editor is loading...
Leave a Comment