Skip to content

Commit

Permalink
Use newSingleThreadExecutor instead of the unbounded newCachedThreadP…
Browse files Browse the repository at this point in the history
…ool so that the thread count is limited to one

We can't shutdown the executor easily, because people reuse the compiler instance. Note that the executor shouldn't be accepting more than one task at a time anyway so this change should be safe.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160703835
  • Loading branch information
Dominator008 authored and brad4d committed Jul 5, 2017
1 parent d117b9b commit 5290f4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/CompilerExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final class CompilerExecutor {
*/
@GwtIncompatible("java.util.concurrent.ExecutorService")
static ExecutorService getDefaultExecutorService() {
return Executors.newCachedThreadPool(new ThreadFactory() {
return Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(null, r, "jscompiler", COMPILER_STACK_SIZE);
Expand Down

0 comments on commit 5290f4f

Please sign in to comment.