MCPcopy Index your code
hub / github.com/apache/tomcat / setThreadCount

Method setThreadCount

java/org/apache/jasper/JspC.java:1048–1068  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

setArgsMethod · 0.95

Calls 5

getMessageMethod · 0.95
endsWithMethod · 0.80
lengthMethod · 0.80
parseIntMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected