[Red5] appStop doesn't get called !?

Nathan Smith nathgs at gmail.com
Sun Jul 20 23:16:47 PDT 2008


I should also mention that I found it useful to use the Jetty shutdown hook,
this way appStop is called even when the java process is terminated by
normal means (rather than relying on the RMI invocation of
org.red5.server.Shutdown).

You can set the Jetty shutdown hook in jetty.xml by adding the following to
the "Server" bean.

<property name="stopAtShutdown" value="true"/>

Tomcat users (which Red5 is now by default) will need to set a shutdown hook
some other way. I'm not using Tomcat myself, but I imagine there will be a
similar mechanism available.

Cheers,

Nathan



On Mon, Jul 21, 2008 at 2:30 PM, Nathan Smith <nathgs at gmail.com> wrote:

> Hi Guys,
>
> I recently faced the same problem where I needed the appStop to be called
> when the Red5 server is shutting down.
>
> I found adding destroy-method="unregister" to my red5-web.xml web.scope
> bean did the trick.
>
> So change:
>
> <bean id="web.scope" class="org.red5.server.WebScope"
> init-method="register">
>
> to
>
> <bean id="web.scope" class="org.red5.server.WebScope"
> init-method="register"
>             destroy-method="unregister">
>
> Hope that helps.
>
> Cheers,
>
> Nathan
>
>
>
>
>
> On Thu, Mar 27, 2008 at 6:17 AM, Mondain <mondain at gmail.com> wrote:
>
>> If you want to catch a shutdown of your java application, you should use a
>> shutdown hook:
>>
>> public class Main {
>>
>>     /**
>>      * Catches an abrupt exit of the application and completes given tasks
>> prior
>>      * to the actual exit.
>>      */
>>     class ShutdownHook extends Thread {
>>         @Override
>>         public void run() {
>>             //do something here when we have been shutdown...
>>         }
>>     }
>>
>>     public Main() {
>>         Runtime.getRuntime().addShutdownHook(new ShutdownHook());
>>     }
>>
>> }
>>
>> Paul
>>
>>
>> On Tue, Mar 25, 2008 at 9:54 AM, Claudius Ceteras <claudius at gmx.de>
>> wrote:
>>
>>> Hi,
>>>
>>> appStop doesn't get called.
>>>
>>> Win2k, java 1.6, red5 0.7, servicewrapper
>>>
>>> When i "net stop red5", i expect appStop to get called, but it doesn't.
>>> Anyone has an idea why? Is this a known issue?
>>>
>>> Code:
>>>        @Override
>>>        public boolean appStart(IScope app) {
>>>                log.info("appStart {}", app);
>>>                appScope = app;
>>>                return super.appStart(app);
>>>        }
>>>
>>>        @Override
>>>        public void appStop(IScope app) {
>>>                log.info("appStop {}", app);
>>>                super.appStop(app);
>>>        }
>>>
>>>
>>>
>>> regards,
>>>
>>> Claudius
>>>
>>>
>>> _______________________________________________
>>> Red5 mailing list
>>> Red5 at osflash.org
>>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>>
>>
>>
>>
>> --
>> It is difficult to free fools from the chains they revere. - Voltaire
>> _______________________________________________
>> Red5 mailing list
>> Red5 at osflash.org
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/red5_osflash.org/attachments/20080721/a411f824/attachment.html 


More information about the Red5 mailing list