Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Display worker count on startup and warn when workers are depleted

  • Loading branch information...
commit 4466c134f8a71d9cac058d516bf8469618f12bb2 1 parent b462958
@FroMage authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 framework/src/play/Invoker.java
View
4 framework/src/play/Invoker.java
@@ -36,6 +36,9 @@
Monitor monitor = MonitorFactory.getMonitor("Invoker queue size", "elmts.");
monitor.add(executor.getQueue().size());
invocation.waitInQueue = MonitorFactory.start("Waiting for execution");
+ if(executor.getActiveCount() >= executor.getCorePoolSize()){
+ Logger.warn("Reached maximum number of workers, queuing the next one");
+ }
return executor.submit(invocation);
}
@@ -224,6 +227,7 @@ public void suspend(Suspend suspendRequest) {
*/
static {
int core = Integer.parseInt(Play.configuration.getProperty("play.pool", Play.mode == Mode.DEV ? "1" : ((Runtime.getRuntime().availableProcessors()+1) + "")));
+ Logger.info("Using %s workers", core);
executor = new ScheduledThreadPoolExecutor(core, new ThreadPoolExecutor.AbortPolicy());
}

1 comment on commit 4466c13

@erwan

merged, but with trace instead of info for the startup log (we want to keep the output as clean as possible, or it's going to become useless)

Please sign in to comment.
Something went wrong with that request. Please try again.