美文网首页
故障模拟

故障模拟

作者: 大大大大大大大熊 | 来源:发表于2019-02-25 13:42 被阅读0次

    jvm的关闭方式有三种:

    1. 正常关闭:当最后一个非守护线程结束或者调用了System.exit或者通过其他特定平台的方法关闭(发送SIGINT,SIGTERM信号等)
    2. 强制关闭:通过调用Runtime.halt方法或者是在操作系统中直接kill(发送SIGKILL信号)掉JVM进程
    3. 异常关闭:运行中遇到RuntimeException异常等。
                if (failTask) {
                    // we fail the task, either by killing the JVM hard, or by throwing a user code exception.
                    if (killTaskOnFailure) {
                        Runtime.getRuntime().halt(-1);
                    } else {
                        throw new RuntimeException("Artificial user code exception.");
                    }
                }
    

    相关文章

      网友评论

          本文标题:故障模拟

          本文链接:https://www.haomeiwen.com/subject/mlzwyqtx.html