Sets the number of threads to use for compilation. Accepts an integer value or a multiplier suffix 'C' for cores (e.g., "2C" means twice the available processors). @param threadCount Thread count string
(String threadCount)
| 1046 | * @param threadCount Thread count string |
| 1047 | */ |
| 1048 | public void setThreadCount(String threadCount) { |
| 1049 | if (threadCount == null) { |
| 1050 | return; |
| 1051 | } |
| 1052 | int newThreadCount; |
| 1053 | try { |
| 1054 | if (threadCount.endsWith("C")) { |
| 1055 | double factor = Double.parseDouble(threadCount.substring(0, threadCount.length() - 1)); |
| 1056 | newThreadCount = (int) (factor * Runtime.getRuntime().availableProcessors()); |
| 1057 | } else { |
| 1058 | newThreadCount = Integer.parseInt(threadCount); |
| 1059 | } |
| 1060 | } catch (NumberFormatException e) { |
| 1061 | throw new BuildException(Localizer.getMessage("jspc.error.parseThreadCount", threadCount)); |
| 1062 | } |
| 1063 | if (newThreadCount < 1) { |
| 1064 | throw new BuildException( |
| 1065 | Localizer.getMessage("jspc.error.minThreadCount", Integer.valueOf(newThreadCount))); |
| 1066 | } |
| 1067 | this.threadCount = newThreadCount; |
| 1068 | } |
| 1069 | |
| 1070 | /** |
| 1071 | * Sets the option to list compilation errors. |