Created
September 19, 2011 07:46
-
-
Save langmi/1226119 to your computer and use it in GitHub Desktop.
AsyncTaskExecutorFactory example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AsyncTaskExecutorFactory { | |
... | |
public static SimpleAsyncTaskExecutor createInstance() { | |
SimpleAsyncTaskExecutor instance = new SimpleAsyncTaskExecutor(); | |
// set concurrencyLimit according to available processors | |
// real simple 1:1 relation | |
Runtime runtime = Runtime.getRuntime(); | |
int nrCpu = runtime.availableProcessors(); | |
instance.setConcurrencyLimit(nrCpu); | |
return instance; | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment