Permalink
Browse files

Display worker count on startup and warn when workers are depleted

  • Loading branch information...
1 parent b462958 commit 4466c134f8a71d9cac058d516bf8469618f12bb2 @FroMage committed Nov 9, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 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 commented on 4466c13 Dec 28, 2010

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.