Changeset 7423 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-08-16T20:14:24+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7356 r7423 42 42 import java.util.Iterator; 43 43 import java.util.List; 44 import java.util.concurrent.ExecutorService; 45 import java.util.concurrent.Executors; 44 46 import java.util.regex.Matcher; 45 47 import java.util.regex.Pattern; … … 1064 1066 return true; 1065 1067 } 1068 1069 /** 1070 * Returns a pair containing the number of threads (n), and a thread pool (if n > 1) to perform 1071 * multi-thread computation in the context of the given preference key. 1072 * @param pref The preference key 1073 * @return a pair containing the number of threads (n), and a thread pool (if n > 1, null otherwise) 1074 * @since 7423 1075 */ 1076 public static Pair<Integer, ExecutorService> newThreadPool(String pref) { 1077 int noThreads = Main.pref.getInteger(pref, Runtime.getRuntime().availableProcessors()); 1078 ExecutorService pool = noThreads <= 1 ? null : Executors.newFixedThreadPool(noThreads); 1079 return new Pair<>(noThreads, pool); 1080 } 1066 1081 }
Note:
See TracChangeset
for help on using the changeset viewer.