|Re: Headless Equinox Clean Shutdown? [message #103071 is a reply to message #103058]
||Mon, 24 December 2007 20:14
Originally posted by: akarypid.yahoo.gr|
Just in case it wasn't clear: the shutdown hook will execute if you send
a SIGTERM to your application. All you have to do is trigger "clean
shutdown" from within the hook, wait for it to complete and return once
it is "safe" for the JVM to proceed with shutdown.
Alexandros Karypidis wrote:
> Actually, even though it is correct you can't add UNIX signal handlers
> to Java, it is possible to catch a JVM that is shutting down with:
> http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html #addShutdownHook(java.lang.Thread)
> If it's not just a daemon thread but a program that also has an RCP UI,
> you should also take a look at the considerations in this blog:
> http://richclientplatform.blogspot.com/2007/09/sigue-sigue-s igterm_12.html
> Snjezana Peco wrote:
>> Java doesn't support Unix signals or similar mechanism for
>> communication between processes. However, you can use TCP/IP.
>> When your Equinox instance gets information on some port you choose,
>> you can smoothly shutdown your instance.
>> You can write data across network connections using Unix "nc" utility.
>> Paul wrote:
>>> I'm looking at building a startup/shutdown script to run a headless
>>> Equinox from "/etc/init.d".
>>> Is there a "nice" way to shutdown the Equinox instance instead of
>>> just sending a kill?
|Re: Headless Equinox Clean Shutdown? [message #103187 is a reply to message #103029]
||Wed, 02 January 2008 16:13
Originally posted by: paule.willcode4beer.com|
Answering my own question.
I've dug through the source a bit and concluded that the simplest thing to
do is to create a start-up class.
This will call the "startup()" method in
'org.eclipse.core.runtime.adaptor.EclipseStarter'. It will then listen on
a port for a shutdown command and (when received), call the "shutdown()"
on the EclipseStarter class.
This should provide a "clean" way to shutdown an Equinox instance. It will
also allow lifecycle events to proceed in the normal way for Equinox and
all bundles that are installed.
I might also, have it re-route the io for the FrameworkConsole in order to
support a remote equinox console.
Powered by FUDForum
. Page generated in 0.02871 seconds