Java service is restarted 4 or 5 times

廉价感情. 提交于 2019-12-01 17:51:38

问题


I am running a Java service to poll data from database. In my class, I have a thread, which looks for data in db every 5 seconds... At particular time(say like 6 PM when out of business hours), i make my thread to sleep to some configured time delay.

Problem: when I make my thread to sleep, it seems my Java service is restarted... Why am I getting 4, 5 JVM launched... Please help me to understand....

ERROR  | wrapper  | 2013/12/21 15:40:10 | JVM did not exit on request, termination requested.
STATUS | wrapper  | 2013/12/21 15:40:10 | JVM exited after being requested to terminate.
STATUS | wrapper  | 2013/12/21 15:40:14 | Launching a JVM...
INFO   | wrapper  | 2013/12/21 15:40:14 | Command: "C:\Windows\system32\java.exe" -Dfile.encoding=Cp1252 -Duser.language=en -Djava.library.path="../lib" -classpath "java-windows-OSN-service.jar;../lib/wrapper.jar;../lib/log4j-1.2.15.jar;../lib/sqljdbc4.jar" -Dwrapper.key="PHie-UB6SOJ9BBlfqJKjPuopQ40gFfnH" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=6116 -Dwrapper.version="3.5.22-pro" -Dwrapper.native_library="wrapper" -Dwrapper.arch="x86" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=4 -Dwrapper.lang.domain=wrapper -Dwrapper.lang.folder=../lang com.servion.service.ServiceController
INFO   | jvm 4    | 2013/12/21 15:40:15 | Control Event: 1
ERROR  | wrapper  | 2013/12/21 15:40:43 | Startup failed: Timed out waiting for a signal from the JVM.

回答1:


Wrapper software communicates with your started JVM very often and checks whether it's alive or not. When you make your application sleep, that communication fails and the wrapper notifies the process hung and attempts to restart it. To avoid this you have to configure the wrapper.ping.timeout in your wrapper conf. To avoid timeout set the property to "0".

Check more details on ping timeout- wrapper.ping.timeout configuration

If you have any timeout issue in the start up of the application (The default timeout value is 30 seconds) Change the value in wrapper conf to "0" in order to avoid restarting application. wrapper.startup.timeout=0

Check more details on startup timeout - wrapper.startup.timeout configuration




回答2:


Just a hunch, but my guess is that when you make your application sleep, you also stop the watchdog mechanism from Tanukisoft to respond to probes, so Tanuki thinks your application is frozen.

Have a look at the integration methods for standalone apps with Tanukisoft : http://wrapper.tanukisoftware.com/doc/english/integrate.html



来源:https://stackoverflow.com/questions/20718058/java-service-is-restarted-4-or-5-times

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!