问题描述
我如何在可配置的时间内暂停JVM的执行,这与在完整的,串行的垃圾收集上发生的情况类似?我想测试一些极端情况,但是很难通过手动生成垃圾+ System.gc()
来创建所需的确切停顿.
How can I suspend the execution of a JVM for a configurable amount of time, similar to want happens on a full, serial, Garbage Collection? I want to test some edge cases but it's difficult to create the exact pauses I need with manually generating garbage + System.gc()
.
我试图冻结"应用程序中的所有线程,以模拟应用程序变得无响应,然后恢复执行的情况.该应用程序是集群的一部分,我正在尝试调试一些离开/加入/重新加入的问题.
I'm trying to 'freeze' all the threads in the application, to simulate a situation where an application becomes unresponsive, and then resumes execution. The application is part of a cluster, and I'm trying to debug some leave / join / re-join problems.
推荐答案
使用虚拟机并完全暂停其执行.
Use a Virtual Machine and suspend its execution outright.
这篇关于在有限的时间内挂起JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!