How do I cleanly shut down an embedded JRuby in response to a SIGTERM to the JVM process?

前端 未结 2 1076
梦毁少年i
梦毁少年i 2021-02-18 15:09

I am running a Middleman (which uses Webrick) server on JRuby inside a JVM process using the org.jruby.embed.ScriptingContainer API.

If I shutdown cleanly a

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-18 15:27

    Looks like kill -9 does not trigger the shutdownHook, but kill -15 does.

    This StackOverflow question has a detailed answer to the same problem.

    Bottom line is, you're screwed, as there doesn't seem to exist any way to intercept a kill -9 signal and perform some maintenance tasks before the JVM halts.

提交回复
热议问题