Skip to content

Commit

Permalink
[playframework#515] Trace worker count on startup and warn when worke…
Browse files Browse the repository at this point in the history
…rs are depleted
  • Loading branch information
FroMage authored and erwan committed Dec 28, 2010
1 parent 58cb510 commit 8aa240f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions framework/src/play/Invoker.java
Expand Up @@ -39,6 +39,9 @@ public static Future<?> invoke(final Invocation invocation) {
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);
}

Expand Down Expand Up @@ -293,6 +296,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.trace("Using %s workers", core);
executor = new ScheduledThreadPoolExecutor(core, new ThreadPoolExecutor.AbortPolicy());
}

Expand Down

0 comments on commit 8aa240f

Please sign in to comment.