Problem using context destroy pipelines

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem using context destroy pipelines

Eric van der Vlist
I am trying to use a pipeline that I have registered as a listener to be
called when the servlet is destroyed to close cleanly Lucene indexes.

However, it looks like the servlet is in a state where the use of new
classes is restricted and I am getting an Illegal access:

16 nov. 2005 14:09:36 org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Suspension de Coyote HTTP/1.1 sur http-7777
16 nov. 2005 14:09:37 org.apache.catalina.core.StandardService stop
INFO: Arrêt du service Catalina
16 nov. 2005 14:09:38 org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  Could not load org.apache.lucene.index.MultiReader.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
16 nov. 2005 14:09:38 org.apache.coyote.http11.Http11BaseProtocol destroy

Is there a way to fix or workaround this kind of issues?

Thanks,

Eric
--
Weblog:
                 http://eric.van-der-vlist.com/blog?t=category&a=English
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem using context destroy pipelines

Erik Bruchez
Administrator
According to the spec:

"public void contextDestroyed(ServletContextEvent sce) - Notification
that the servlet context is about to be shut down. All servlets have
been dstroy()ed before any ServletContextListeners are notified of
context destruction."

Now whether that somehow implies that the WebappClassLoader no longer
loads classes, I don't know, but apparently, in Tomcat, that's the case.
There are only two events, contextInitialized() and contextDestroyed(),
that you can catch at that level.

You could try to detect the destroy() of a servlet instead, but OPS
doesn't allow you to configure listeners there at this point.

-Erik

Eric van der Vlist wrote:

> I am trying to use a pipeline that I have registered as a listener to be
> called when the servlet is destroyed to close cleanly Lucene indexes.
>
> However, it looks like the servlet is in a state where the use of new
> classes is restricted and I am getting an Illegal access:
>
> 16 nov. 2005 14:09:36 org.apache.coyote.http11.Http11BaseProtocol pause
> INFO: Suspension de Coyote HTTP/1.1 sur http-7777
> 16 nov. 2005 14:09:37 org.apache.catalina.core.StandardService stop
> INFO: Arr?t du service Catalina
> 16 nov. 2005 14:09:38 org.apache.catalina.loader.WebappClassLoader loadClass
> INFO: Illegal access: this web application instance has been stopped already.  Could not load org.apache.lucene.index.MultiReader.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
> 16 nov. 2005 14:09:38 org.apache.coyote.http11.Http11BaseProtocol destroy
>
> Is there a way to fix or workaround this kind of issues?
>
> Thanks,
>
> Eric


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem using context destroy pipelines

Eric van der Vlist
Le mercredi 16 novembre 2005 à 15:26 +0100, Erik Bruchez a écrit :
> According to the spec:
>
> "public void contextDestroyed(ServletContextEvent sce) - Notification
> that the servlet context is about to be shut down. All servlets have
> been dstroy()ed before any ServletContextListeners are notified of
> context destruction."

That means that this is already too late to gracefully terminate
processors running in background (which is what I need to do)...

> Now whether that somehow implies that the WebappClassLoader no longer
> loads classes, I don't know, but apparently, in Tomcat, that's the case.
> There are only two events, contextInitialized() and contextDestroyed(),
> that you can catch at that level.

:-(

> You could try to detect the destroy() of a servlet instead, but OPS
> doesn't allow you to configure listeners there at this point.

Would that just be a matter of copy/pasting with minor adaptations the
content of:

    public void contextDestroyed(ServletContextEvent event) {
        try {
            InitUtils.run(event.getServletContext(), null, DESTROY_PROCESSOR_PROPERTY_PREFIX, DESTROY_PROCESSOR_INPUT_PROPERTY);
        } catch (Exception e) {
            logger.error("Exception when running Servlet context destruction processor", OXFException.getRootThrowable(e));
            throw new OXFException(e);
        }
    }

into the destroy() method of the OXFServletDelegate class?

If that's the case, that would be worth IMO :-) ...

The property for the current feature is (correctly) named
"oxf.context-destroyed-processor." and we add a
"oxf.servlet-destroy-processor." property.

Eric
--
Carnet web :
           http://eric.van-der-vlist.com/blog?t=category&a=Fran%C3%A7ais
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem using context destroy pipelines

Erik Bruchez
Administrator
Eric van der Vlist wrote:

> Would that just be a matter of copy/pasting with minor adaptations the
> content of:

[...]

> into the destroy() method of the OXFServletDelegate class?
>
> If that's the case, that would be worth IMO :-) ...
>
> The property for the current feature is (correctly) named
> "oxf.context-destroyed-processor." and we add a
> "oxf.servlet-destroy-processor." property.

I added an RFE for this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=304317&group_id=168&atid=350210

For consistency, there should be one for init(), one for destroy().

I think the code would be very similar to what you now have in the
listeners, except the property should check first servlet params, then
the context params. This would allow different listeners per servlet, or
the same listeners for all servlets.

-Erik



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Problem using context destroy pipelines

Erik Bruchez
Administrator
Erik Bruchez wrote:

>> The property for the current feature is (correctly) named
>> "oxf.context-destroyed-processor." and we add a
>> "oxf.servlet-destroy-processor." property.
>
>
> I added an RFE for this:
>
> http://forge.objectweb.org/tracker/index.php?func=detail&aid=304317&group_id=168&atid=350210 
>
>
> For consistency, there should be one for init(), one for destroy().
>
> I think the code would be very similar to what you now have in the
> listeners, except the property should check first servlet params, then
> the context params. This would allow different listeners per servlet, or
> the same listeners for all servlets.
This is now implemented in the latest CVS. Example listeners printing
out messages are hooked up as well.

-Erik



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws