shutdown-hook

Could not load org.apache.hadoop.util.ShutdownHookManager when shutdown tomcat server

笑着哭i 提交于 2019-12-22 08:06:05
问题 I have a simple web application run on tomcat. This web application read and write file to HDFS. The issue I am facing is each time when I stop the server by using ./bin/shutdown.sh . I am getting could not load hadoop shutdownHookManager exception. I am sure the hadoop-common (contains ShutDownManager) is in tomcat classpath. Can anyone help me out? Exception I got: Oct 14, 2013 5:57:54 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application []

shutdown hook doesn't fire when running with “lein run”

。_饼干妹妹 提交于 2019-12-20 17:34:30
问题 I have the following code: (ns test-hook.core) (defn -main [] (.addShutdownHook (Runtime/getRuntime) (Thread. #(println "shutdown"))) (println "start") (doseq [i (range 1 6)] (Thread/sleep 1000) (println i))) and the following project.clj (defproject test-hook "1.0.0-SNAPSHOT" :aot :all :main test-hook.core :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.0"]]) when I run it with "lein run" the shutdown hook only gets executed on normal program execution, not

Finding out who calls jvm shutdown hook

前提是你 提交于 2019-12-19 05:08:11
问题 I have Windows Desktop application based on Java. I have kept defaultuncaughtexceptionahandler and shutdown hook in my application. I have some user called exit points like , user clicks on exit, some error conditions etc. All the user exit points have proper logs which will be followed by the log in shutdown hook. Now for one of my user the application is getting exited from time to time . here user is not calling any user exit points. Shutdown hook logs are printed. There is no exception

Windows shutdown hook on java application run from a bat script

回眸只為那壹抹淺笑 提交于 2019-12-17 10:49:25
问题 I have a bat script which runs a java application. If I press ctrl+c on it, it the application terminates gracefully, invoking all the shutdown hooks. However, if I just close the cmd window of the bat script, the shutdown hooks are never invoked. Is there a way to solve this? Perhaps there's a way to tell the bat script how to terminate the invoked applications when its window is closed? 回答1: From addShutdownHook documentation: In rare circumstances the virtual machine may abort, that is,

SimpleMessageListenerContainer shutdowntimeout

别等时光非礼了梦想. 提交于 2019-12-11 04:29:08
问题 I am using spring-rabbit-1.7.3.RELEASE.jar I have defined a SimpleMessageListenerContainer in my xml with shutdownTimeout parameter. bean id="aContainer" class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer"> <property name="connectionFactory" ref="rabbitConnectionFactory" /> <property name="queueNames" value="aQueue" /> <property name="adviceChain" ref="retryAdvice" /> <property name="acknowledgeMode" value="AUTO" /> <property name="shutdownTimeout" value="900000" /

Java shutdown hook call on windows shut down

若如初见. 提交于 2019-12-11 03:55:43
问题 I have a situation in which I want to perform some task when the user signals the OS(in my case only Windows) to shutdown. I have tried using java shutdown hooks. The problem I face is that when I exit the program using System.exit(0); , the shutdown hooks are called but when I directly shutdown the computer, they aren't. This is the code I have used for the shutdown hooks- Runtime.getRuntime().addShutdownHook(new JVMShutdownHook()); //in main method //within the main java class private

How long does the JVM allow shutdown hooks to run before calling halt?

我与影子孤独终老i 提交于 2019-12-11 03:17:22
问题 Follow up from previous question If you've read the previous question an alternative title may be: How often should my daemon check to see if it's been interrupted? 回答1: When the JVM is signaled to quit it runs a shutdown process, which starts all of the shutdown hook threads and then waits for them to finish. It is up to the OS to decide how long to wait and that depends on the method used to initiate the termination of the process. You can try this for yourself with a simple test program

Why does the official JVM documentation contradict its implementation in addShutdownHook?

做~自己de王妃 提交于 2019-12-11 00:36:57
问题 There's a bit of a clash for whether shutdown hooks, which are of class Thread , run their runnable code on the thread on which the shutdown was called, or run on themselves. addShutdownHook takes a Thread as a parameter. This implies the thread will start and run its run method on itself. This is also consistent with the documentation for addShutdownHook : public void addShutdownHook(Thread hook) Registers a new virtual-machine shutdown hook. The Java virtual machine shuts down in response

Detecting that JVM is shutting down

霸气de小男生 提交于 2019-12-10 22:19:11
问题 I have a Swing application that handles Ctrl+C using addShutdownHook(), and it works fine until one of the shutdown tasks I have calls a function that under normal circumstances changes a JLabel text, at which point it hangs. I assume the problem is that the Swing EDT has either terminated or is waiting for something. Is there a way to either determine that the EDT has terminated or is "done" (so I can avoid calling Swing methods), or to prevent the usual close-all-the-windows-down behavior

In PHP does max_execution_time affect shutdown functions that are run through a register_shutdown_function() call?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 14:49:40
问题 I have a shutdown function registered using register_shutdown_function() that takes a long time to complete. Will PHP's max_execution_time cause PHP to terminate this function or will it run until it completes or errors out? 回答1: It will run to completion. http://us2.php.net/manual/en/function.register-shutdown-function.php#33575 来源: https://stackoverflow.com/questions/4620517/in-php-does-max-execution-time-affect-shutdown-functions-that-are-run-through-a