|
From: Leif M. <le...@ta...> - 2004-02-16 04:16:04
|
Rob,
Starting with Java 1.3, a feature called shutdown hooks were added
to Java. A
method was added to the java.lang.Runtime class which allows you to
register a
Thread which will be started when the JVM starts to shutdown. This can be
triggered by either hitting CTRL-C or by calling System.exit someplace
in the
code.
In the case of the Wrapper, a request by the Wrapper to shutdown the
JVM results in System.exit being called from within the JVM. This
results in all
registered shutdown hooks being executed before the JVM actually shuts down.
JBoss registers such a shutdown hook to handle the case where the user
presses
CTRL-C. This makes it very easy to integrate with the Wrapper.
Tomcat on the other hand does not register any shutdown hooks and
will this
shutdown hard if you hit CTRL-C in the console. In order to shut it
down cleanly
another class must be executed. That is why its integration makes use
of the
WrapperStartStopApp helper class.
As a note, if you want your application to exit the JVM without
executing any
shutdown hooks you can do so by calling Runtime.getRuntime.halt()
Cheers,
Leif
Rob Moore wrote:
> Hi, Leif,
>
> Thanks for your response. The WrapperSimpleApp is working fine, but I
> just had the understanding that I needed to notify JBoss to shut
> itself down properly. From what you are saying, this is the case by
> default. I'm just curious how this is communicated to JBoss -- is it
> equivalent to hitting control-c in the console window?
>
> Rob
>
> Leif Mortenson wrote:
>
>> Rob,
>>
>> I have never tried that integration method with JBoss. Is there a
>> reason why the
>>
>> WrapperSimpleApp method is not working for you? JBoss shuts down
>> normally
>>
>> using its own shutdown hook so you shouldn't have to be calling a stop
>> method.
>>
>>
>>
>> When using the WrapperStartStopApp, both the start and stop classes
>> are loaded
>>
>> using the same class path. This will only work for applications which
>> allow that.
>>
>>
>>
>> Also what are the errors you are seeing so I can help you without
>> trying to
>>
>> reproduce your configuration in the dark.
>>
>>
>>
>> Cheers,
>>
>> Leif
>>
>>
>>
>> Rob Moore wrote:
>>
>>
>>
>>> Has anybody been able to get WrapperStartStopApp to work successfully
>>
>>
>>
>>> with JBoss?
>>
>>
>>
>>>
>>
>>> I would like to use the WrapperStartStopApp with JBoss, but I get
>>
>>
>>
>>> errors when I attempt to do so (I don't see the errors using
>>
>>
>>
>>> WrapperSimpleApp) that appear to be related to the classpath. It looks
>>
>>
>>
>>> like the problem results from the fact that I have to include all of
>>
>>
>>
>>> the jars needed for startup and shutdown. So I was curious if there is
>>
>>
>>
>>> a way to specify some jars in the classpath to be used for start and
>>
>>
>>
>>> others to be used for stop.
>>
|