gpt4 book ai didi

playframework - 如何在 Play Framework 中检查事件和排队的作业数?

转载 作者:行者123 更新时间:2023-12-04 05:50:45 25 4
gpt4 key购买 nike

我的应用程序必须通过 HTTP API 报告其作业负载。 “Play 状态”命令似乎提供了我需要的信息:

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

如何在 Play Framework Controller 中访问此信息?

最佳答案

看看 JobsPlugin.java,有一个静态的 executor 属性,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());

关于playframework - 如何在 Play Framework 中检查事件和排队的作业数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8786070/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com