2012-01-09 40 views
4

我的應用程序必須通過HTTP API報告其工作負載。 「播放狀態」命令似乎給的信息,我需要:如何查看Play框架中的活動和排隊作業數量?

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

如何在遊戲框架控制器訪問此信息?

+0

你知道什麼是「播放狀態相當於」在Play 2.x中? – invinc4u 2014-07-11 13:26:38

回答

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());