How to check the number of active and delivered tasks in the Play Framework?

My application should report its workload through the HTTP API. The Play Status command seems to give me the information I need:

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

How to access this information in the controller Play Framework?

+4
source share
1 answer

Look at JobPlugin.java, there is a static executor property, the getStatus () method shows where the values ​​came from: 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()); 
+6
source

Source: https://habr.com/ru/post/1390007/


All Articles