package com.secondworld.sdk;
|
|
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.Executors;
|
|
//耗时任务操作
|
public class AsyncTaskOperator {
|
|
public static AsyncTaskOperator I = new AsyncTaskOperator();
|
|
private ExecutorService cachedThreadPool;
|
|
private ExecutorService getCachedThreadPool() {
|
if (cachedThreadPool == null) {
|
cachedThreadPool = Executors.newCachedThreadPool();
|
}
|
return cachedThreadPool;
|
}
|
|
public void run(Runnable runnable) {
|
getCachedThreadPool().execute(runnable);
|
}
|
|
}
|