You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yuriy Stul <yu...@bladefusion.com> on 2002/10/07 10:33:26 UTC

Action on close

Hello,
it is possible to specify a class what must be called (loaded) on startup
(web.xml, <servlet> <load-on-startup> ...). It is working fine.

My question is it possible to specify any servlet what will be loaded before
Tomcat shutdown?

Thanks in advance

================
Regards,
   Yuriy
Sr. Software Eng.
<ma...@bladefusion.com>
http://www.bladefusion.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action on close

Posted by David Mossakowski <dm...@Instinet.Com>.
You're right and that's what I said.  Jake got the right answer.

BTW why 'Death to all load on startup servlets'?  Personal preference?

d.

jon wingfield wrote:
> You can't rely on the destroy() method on the servlet for this purpose. The
> container has the right to unload servlets when it chooses as a part of
> resources management. If you are using a servlet 2.3 spec container use the
> ServletContextListener as Jake suggests.
> 
> <flame-retardent-suit>
> Death to all load on startup servlets ;)
> </flame-retardent-suit>
> 
> Jon
> 
> -----Original Message-----
> From: Jacob Kjome [mailto:hoju@visi.com]
> Sent: 07 October 2002 16:07
> To: Tomcat Users List
> Subject: Re: Action on close
> 
> 
> Yep,
> 
> Servlet 2.3 introduced the concenpt of the ServletContextListener which
> contains
>  contextInitialized() and contextDestroyed() which are guaranteed to be
> loaded
> once at startup and once at shutdown, respectively.
> 
> You just need a class that implements ServletContextListener and specify it
> in
> the web.xml as:
> 
> <listener>
>         <listener-class>
>         org.myapp.listeners.MyServletContextListener
>         </listener-class>
> </listener>
> 
> There you go.
> 
> Jake
> 
> Quoting David Mossakowski <dm...@Instinet.Com>:
> 
> 
>>There's a destroy() method called on a servlet when it is unloaded from
>>Tomcat.  You can't depend on that to mean that Tomcat is shutting down
>>but maybe it could be helpful.
>>
>>d.
>>
>>Yuriy Stul wrote:
>>
>>>Hello,
>>>it is possible to specify a class what must be called (loaded) on
>>
> startup
> 
>>>(web.xml, <servlet> <load-on-startup> ...). It is working fine.
>>>
>>>My question is it possible to specify any servlet what will be loaded
>>
>>before
>>
>>>Tomcat shutdown?
>>>
>>>Thanks in advance
>>>
>>>================
>>>Regards,
>>>   Yuriy
>>>Sr. Software Eng.
>>><ma...@bladefusion.com>
>>>http://www.bladefusion.com
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>
>><ma...@jakarta.apache.org>
>>
>>>For additional commands, e-mail:
>>
>><ma...@jakarta.apache.org>
>>
>>>
>>>
>>
>>--
>>David Mossakowski              dmoss@instinet.com
>>Instinet Corporation                 212.310.7275
>>
>>
>>
>>
> 
> ****************************************************************************
> ***
> 
>><<Disclaimer>>
>>
>>This message is intended only for the use of the Addressee and
>>may contain information that is PRIVILEGED and/or
>>CONFIDENTIAL or both.
>>
>>This email is intended only for the personal and confidential use
>>of the recipient(s) named above.
>>
>>If the reader of this email is not an intended recipient, you have
>>received this email in error and any review, dissemination,
>>distribution or copying is strictly prohibited.
>>
>>If you have received this email in error, please notify the sender
>>immediately by return mail and permanently deleting the copy
>>you received.
>>
>>Thank you.
>>
>>
> 
> ****************************************************************************
> ***
> 
>>
>>--
>>To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail:
>><ma...@jakarta.apache.org>
>>
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 


-- 
David Mossakowski              dmoss@instinet.com
Instinet Corporation                 212.310.7275



****************************************************************************
<<Disclaimer>>

This message is intended only for the use of the Addressee and 
may contain information that is PRIVILEGED and/or
CONFIDENTIAL or both.

This email is intended only for the personal and confidential use
of the recipient(s) named above.

If the reader of this email is not an intended recipient, you have
received this email in error and any review, dissemination,
distribution or copying is strictly prohibited.

If you have received this email in error, please notify the sender
immediately by return mail and permanently deleting the copy
you received.

Thank you.

****************************************************************************


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Action on close

Posted by jon wingfield <jo...@mkodo.com>.
You can't rely on the destroy() method on the servlet for this purpose. The
container has the right to unload servlets when it chooses as a part of
resources management. If you are using a servlet 2.3 spec container use the
ServletContextListener as Jake suggests.

<flame-retardent-suit>
Death to all load on startup servlets ;)
</flame-retardent-suit>

Jon

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com]
Sent: 07 October 2002 16:07
To: Tomcat Users List
Subject: Re: Action on close


Yep,

Servlet 2.3 introduced the concenpt of the ServletContextListener which
contains
 contextInitialized() and contextDestroyed() which are guaranteed to be
loaded
once at startup and once at shutdown, respectively.

You just need a class that implements ServletContextListener and specify it
in
the web.xml as:

<listener>
        <listener-class>
        org.myapp.listeners.MyServletContextListener
        </listener-class>
</listener>

There you go.

Jake

Quoting David Mossakowski <dm...@Instinet.Com>:

> There's a destroy() method called on a servlet when it is unloaded from
> Tomcat.  You can't depend on that to mean that Tomcat is shutting down
> but maybe it could be helpful.
>
> d.
>
> Yuriy Stul wrote:
> > Hello,
> > it is possible to specify a class what must be called (loaded) on
startup
> > (web.xml, <servlet> <load-on-startup> ...). It is working fine.
> >
> > My question is it possible to specify any servlet what will be loaded
> before
> > Tomcat shutdown?
> >
> > Thanks in advance
> >
> > ================
> > Regards,
> >    Yuriy
> > Sr. Software Eng.
> > <ma...@bladefusion.com>
> > http://www.bladefusion.com
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> >
>
>
> --
> David Mossakowski              dmoss@instinet.com
> Instinet Corporation                 212.310.7275
>
>
>
>
****************************************************************************
***
> <<Disclaimer>>
>
> This message is intended only for the use of the Addressee and
> may contain information that is PRIVILEGED and/or
> CONFIDENTIAL or both.
>
> This email is intended only for the personal and confidential use
> of the recipient(s) named above.
>
> If the reader of this email is not an intended recipient, you have
> received this email in error and any review, dissemination,
> distribution or copying is strictly prohibited.
>
> If you have received this email in error, please notify the sender
> immediately by return mail and permanently deleting the copy
> you received.
>
> Thank you.
>
>
****************************************************************************
***
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action on close

Posted by Jacob Kjome <ho...@visi.com>.
Yep,

Servlet 2.3 introduced the concenpt of the ServletContextListener which contains
 contextInitialized() and contextDestroyed() which are guaranteed to be loaded
once at startup and once at shutdown, respectively.

You just need a class that implements ServletContextListener and specify it in
the web.xml as:

<listener>
        <listener-class>
        org.myapp.listeners.MyServletContextListener
        </listener-class>
</listener>

There you go.

Jake

Quoting David Mossakowski <dm...@Instinet.Com>:

> There's a destroy() method called on a servlet when it is unloaded from 
> Tomcat.  You can't depend on that to mean that Tomcat is shutting down 
> but maybe it could be helpful.
> 
> d.
> 
> Yuriy Stul wrote:
> > Hello,
> > it is possible to specify a class what must be called (loaded) on startup
> > (web.xml, <servlet> <load-on-startup> ...). It is working fine.
> > 
> > My question is it possible to specify any servlet what will be loaded
> before
> > Tomcat shutdown?
> > 
> > Thanks in advance
> > 
> > ================
> > Regards,
> >    Yuriy
> > Sr. Software Eng.
> > <ma...@bladefusion.com>
> > http://www.bladefusion.com
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > 
> > 
> > 
> 
> 
> -- 
> David Mossakowski              dmoss@instinet.com
> Instinet Corporation                 212.310.7275
> 
> 
> 
> *******************************************************************************
> <<Disclaimer>>
> 
> This message is intended only for the use of the Addressee and 
> may contain information that is PRIVILEGED and/or
> CONFIDENTIAL or both.
> 
> This email is intended only for the personal and confidential use
> of the recipient(s) named above.
> 
> If the reader of this email is not an intended recipient, you have
> received this email in error and any review, dissemination,
> distribution or copying is strictly prohibited.
> 
> If you have received this email in error, please notify the sender
> immediately by return mail and permanently deleting the copy
> you received.
> 
> Thank you.
> 
> *******************************************************************************
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Action on close

Posted by David Mossakowski <dm...@Instinet.Com>.
There's a destroy() method called on a servlet when it is unloaded from 
Tomcat.  You can't depend on that to mean that Tomcat is shutting down 
but maybe it could be helpful.

d.

Yuriy Stul wrote:
> Hello,
> it is possible to specify a class what must be called (loaded) on startup
> (web.xml, <servlet> <load-on-startup> ...). It is working fine.
> 
> My question is it possible to specify any servlet what will be loaded before
> Tomcat shutdown?
> 
> Thanks in advance
> 
> ================
> Regards,
>    Yuriy
> Sr. Software Eng.
> <ma...@bladefusion.com>
> http://www.bladefusion.com
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 


-- 
David Mossakowski              dmoss@instinet.com
Instinet Corporation                 212.310.7275



*******************************************************************************
<<Disclaimer>>

This message is intended only for the use of the Addressee and 
may contain information that is PRIVILEGED and/or
CONFIDENTIAL or both.

This email is intended only for the personal and confidential use
of the recipient(s) named above.

If the reader of this email is not an intended recipient, you have
received this email in error and any review, dissemination,
distribution or copying is strictly prohibited.

If you have received this email in error, please notify the sender
immediately by return mail and permanently deleting the copy
you received.

Thank you.

*******************************************************************************


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>