216 // Do the compilations, repeatedly until no tainted packages exist. |
216 // Do the compilations, repeatedly until no tainted packages exist. |
217 boolean again; |
217 boolean again; |
218 // Collect the name of all compiled packages. |
218 // Collect the name of all compiled packages. |
219 Set<String> recently_compiled = new HashSet<>(); |
219 Set<String> recently_compiled = new HashSet<>(); |
220 boolean[] rc = new boolean[1]; |
220 boolean[] rc = new boolean[1]; |
|
221 boolean background = Util.extractBooleanOption("background", options.getServerConf(), true); |
221 Sjavac sjavac; |
222 Sjavac sjavac; |
222 boolean background = Util.extractBooleanOption("background", options.getServerConf(), true); |
223 // Create an sjavac implementation to be used for compilation |
|
224 if (background) { |
|
225 sjavac = new SjavacClient(options); |
|
226 } else { |
|
227 int poolsize = Util.extractIntOption("poolsize", options.getServerConf()); |
|
228 if (poolsize <= 0) |
|
229 poolsize = Runtime.getRuntime().availableProcessors(); |
|
230 sjavac = new PooledSjavac(new SjavacImpl(), poolsize); |
|
231 } |
|
232 |
223 do { |
233 do { |
224 // Clean out artifacts in tainted packages. |
234 // Clean out artifacts in tainted packages. |
225 javac_state.deleteClassArtifactsInTaintedPackages(); |
235 javac_state.deleteClassArtifactsInTaintedPackages(); |
226 // Create an sjavac implementation to be used for compilation |
|
227 if (background) { |
|
228 sjavac = new SjavacClient(options); |
|
229 } else { |
|
230 int poolsize = Util.extractIntOption("poolsize", options.getServerConf()); |
|
231 if (poolsize <= 0) |
|
232 poolsize = Runtime.getRuntime().availableProcessors(); |
|
233 sjavac = new PooledSjavac(new SjavacImpl(), poolsize); |
|
234 } |
|
235 |
|
236 again = javac_state.performJavaCompilations(sjavac, options, recently_compiled, rc); |
236 again = javac_state.performJavaCompilations(sjavac, options, recently_compiled, rc); |
237 if (!rc[0]) break; |
237 if (!rc[0]) break; |
238 } while (again); |
238 } while (again); |
239 // Only update the state if the compile went well. |
239 // Only update the state if the compile went well. |
240 if (rc[0]) { |
240 if (rc[0]) { |