如何检查Play框架中的活动和排队作业?

时间:2012-01-09 09:15:30

标签: playframework

我的应用必须通过HTTP API报告其工作量。 “播放状态”命令似乎提供了我需要的信息:

Jobs execution pool:
~~~~~~~~~~~~~~~~~~~
Pool size: 0
Active count: 0
Scheduled task count: 0
Queue size: 0

如何在Play Framework 控制器中访问此信息

1 个答案:

答案 0 :(得分:6)

看一下JobsPlugin.java,有一个静态执行器属性,getStatus()方法显示值的来源: https://github.com/playframework/play/blob/master/framework/src/play/jobs/JobsPlugin.java

    out.println("Jobs execution pool:");
    out.println("~~~~~~~~~~~~~~~~~~~");
    out.println("Pool size: " + JobsPlugin.executor.getPoolSize());
    out.println("Active count: " + JobsPlugin.executor.getActiveCount());
    out.println("Scheduled task count: " + JobsPlugin.executor.getTaskCount());
    out.println("Queue size: " + JobsPlugin.executor.getQueue().size());