Make exit logic a bit more verbose/loggy.
Also invoking the java.lang.System.exit method when on the JVM to make sure we're shutting down the JVM properly. I have my doubts that this is happening currently
This commit is contained in:
parent
fb946f0b2c
commit
7413a033bd
|
@ -1,6 +1,11 @@
|
|||
# Changes to Stapfen
|
||||
|
||||
|
||||
## 2.0.1
|
||||
|
||||
* More verbose exit handlers
|
||||
* Invoke `java.lang.System.exit` on the JVM when exiting
|
||||
|
||||
## 2.0.0
|
||||
|
||||
* Add support for JMS-backed `Stapfen::Worker` classes
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Stapfen
|
||||
VERSION = '2.0.0'
|
||||
VERSION = '2.0.1'
|
||||
end
|
||||
|
|
|
@ -125,6 +125,11 @@ module Stapfen
|
|||
end
|
||||
end
|
||||
|
||||
if RUBY_PLATFORM == 'java'
|
||||
info "Telling the JVM to exit cleanly"
|
||||
Java::JavaLang::System.exit(0)
|
||||
end
|
||||
|
||||
return cleanly
|
||||
end
|
||||
|
||||
|
@ -208,14 +213,19 @@ module Stapfen
|
|||
# Invokes the shutdown block if it has been created, and closes the
|
||||
# {{Stomp::Client}} connection unless it has already been shut down
|
||||
def exit_cleanly
|
||||
info("#{self} exiting cleanly")
|
||||
info("#{self} exiting ")
|
||||
self.class.destructor.call if self.class.destructor
|
||||
|
||||
# Only close the client if we have one sitting around
|
||||
if client
|
||||
unless client.closed?
|
||||
client.close
|
||||
info "Killing client"
|
||||
begin
|
||||
# Only close the client if we have one sitting around
|
||||
if client
|
||||
unless client.closed?
|
||||
client.close
|
||||
end
|
||||
end
|
||||
rescue StandardError => exc
|
||||
error "Exception received while trying to close client! #{exc.inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue