[jboss-user] [Microcontainer] - Lifecycle stop() method and new objects

gcompienne do-not-reply at jboss.com
Thu Nov 27 13:55:59 EST 2008


Hello,

I just noticed an interesting problem with the bean lifecycle method "stop()".

It seems that once we are in the stop method the classloader is not available anymore... 

Currently in my stop method, the code build an array from a list doing the following bit:

handlers = m_Handlers.toArray(new Handler[m_Handlers.size()]);

Now if, for some reason, the service was not used and the list was empty then the Handler class has not been loaded yet. It is only when my "stop" implementation tries to clean up everything that it needs to create a dummy array of "Handler".

I agree I can easily fix my code (already done! ;-) ) but still, I wonder if it would not be safer to close the access to the classloader only once the "stop" method has executed.

I kind of agree that for "destroy" it is probably reasonable. But I do wonder if there is not some legitimate situations where "stop" could really need to load one or two objects using the classloader (for example reporting some final stats results into some dedicated objects).

Any opinions?

Gilles.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4192866#4192866

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4192866



More information about the jboss-user mailing list