geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevan Miller <>
Subject Re: Difference in start/stop and restart behavior
Date Thu, 13 Aug 2009 00:19:27 GMT

On Aug 12, 2009, at 6:08 AM, Ashish Jain wrote:

> Hi,
> Recently I have seen difference in the functionality of stop/start  
> and restart options available against each module. In case of stop/ 
> start I see old classloaders
> being discarded and new ones being created. In case of restart same  
> old classloaders are used.
> I am attaching a sample DummyProject here and an explanation of how  
> it works
> It has three classes: TestServlet , TestService and TestBean
> 1. Request comes to the TestServlet => Console prints “In TestServlet”
> 2. TestServlet makes a call to the TestService class. TestService  
> class has a static variable called testBean of type TestBean. This  
> variable is an initialized during class loading.
> 4. When the call comes to TestService, if the static variable is  
> created then the Console prints “In TestBean constructor”. In case  
> the static variables isn't created then this statement doesn’t get  
> printed to the console.
> 5. After which console prints “In TestService class”
> Steps to run the application:
> 1.    Deploy this application to WAS community edition
> 2.    Start the application
> 3.    Hit the <WAS url>/<context>/TestServlet
> 4.    Check the console
> If static variables are created then all the three statements must  
> appear as below in the console:
> => In TestServlet
> => In TestBean constructor
> => In TestService class
> Restart the application and follow steps 2, 3 and 4. Notice only  
> first and last statements ('In TestServlet' & ' In TestService  
> class') appear indicating that static variables aren't created. But  
> when stop and the start this application, all the 3 statements appear.
> I would  like to know if this difference is intended or does it  
> require some fix so that restart behaves in a similar manner as stop/ 
> start?

I'm not sure. My guess is that the differences are unintended, but I'd  
have to spend some time to be sure... There may be some consequences  
to changing this behavior. David J may have thoughts on this...

A Stop is going to stop a configuration, then unload the configuration  
(which will destroy the ClassLoader).

A restart is going to stop a configuration, then start the same  
configuration (reusing the same ClassLoader). Thus any static  
initialization would have already occurred.

Personally, I think a Restart should be functionally equivalent to  

View raw message