Skip to content

Commit

Permalink
Merge pull request #3 from twolight/master
Browse files Browse the repository at this point in the history
Add a implement to release the thread pool.
  • Loading branch information
markzhai committed Oct 15, 2015
2 parents f26011d + 3a4aea6 commit e45c5e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion init/src/main/java/cn/zhaiyifan/init/Init.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,19 @@ public static ExecutorService getThreadPool() {
/**
* create a thread pool.
*/
public static void createThreadPool(){
private static void createThreadPool(){
if (mThreadPoolSize <= 0) {
mExecutorService = Executors.newCachedThreadPool();
} else {
mExecutorService = Executors.newFixedThreadPool(mThreadPoolSize);
}
}

/**
* This executor will be shutdown if it is no longer referenced and has no threads.
*
*/
public static void releaseThreadPool() {
mExecutorService = null;
}
}

0 comments on commit e45c5e7

Please sign in to comment.