Headless Equinox Clean Shutdown? [message #103029] |
Mon, 24 December 2007 18:32 |
Eclipse User |
|
|
|
Originally posted by: paule.willcode4beer.com
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?
thx
|
|
|
|
Re: Headless Equinox Clean Shutdown? [message #103058 is a reply to message #103045] |
Tue, 25 December 2007 01:11 |
Eclipse User |
|
|
|
Originally posted by: akarypid.yahoo.gr
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.
>
> Snjeza
>
>
> 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?
>>
>> thx
>>
|
|
|
Re: Headless Equinox Clean Shutdown? [message #103071 is a reply to message #103058] |
Tue, 25 December 2007 01:14 |
Eclipse User |
|
|
|
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.
>>
>> Snjeza
>>
>>
>> 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?
>>>
>>> thx
>>>
|
|
|
|
Re: Headless Equinox Clean Shutdown? [message #103168 is a reply to message #103058] |
Wed, 02 January 2008 20:35 |
Eclipse User |
|
|
|
Originally posted by: paule.willcode4beer.com
point taken but, regarding Equniox, is it ok to just kill it?
usually, a platform comes with some means to conduct a clean shutdown.
this makes it look like I'll need to submit a patch to the equinox project
to provide lifecycle methods.
|
|
|
Re: Headless Equinox Clean Shutdown? [message #103173 is a reply to message #103156] |
Wed, 02 January 2008 20:41 |
Eclipse User |
|
|
|
Originally posted by: paule.willcode4beer.com
I forgot to ask, is it ok to just kill Equinox?
Eclipse doesn't seem to like it when you do that.
Is there no hook/command to tell the Equinox platform to shutdown
gracefully?
|
|
|
Re: Headless Equinox Clean Shutdown? [message #103187 is a reply to message #103029] |
Wed, 02 January 2008 21:13 |
Eclipse User |
|
|
|
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.03199 seconds