jvanzyl     01/05/30 13:54:18

  Modified:    src/java/org/apache/turbine/services BaseServiceBroker.java
  Log:
  - fixing the services shutdown problem reported by John Thorhauer.
  
    when i changed the services to use the Configuration class i didn't
    apply the changes to the shutdown() in the BaseServiceBroker. my mistake,
    sorry for the trouble.
  
    an Enumeration was being used to get the service names in the
    shutdown(), this was completely erroneous because the list returned
    isn't even ordered correctly.
  
    code should be added to the ExtendedProperties (was Configuration)
    in the commons but i just added a quick fix to take the ordered
    list of services and reverse it, then use the reversed list to
    shutdown the services.
  
    i turned on the scheduler in the TDK sample app, performed a
    proper start/stop and the reported error message is gone.
  
    this is what it looks like now, but there still appears to be
    some funny business at the end as some services seem to
    be initialized at the end of the shutdown. even with this
    strangeness every appears to be ok.
  
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down all services!
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: VelocityService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: XSLTService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: TemplateService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: PullService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: MapBrokerService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: PoolBrokerService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: SecurityService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: UploadService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: UniqueIdService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Turbine instance running at 
http://localhost:8080/newapp/servlet/newapp shutting down.
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: XmlRpcService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: SchedulerService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: GlobalCacheService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: MimeTypeService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: LocalizationService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: 
AssemblerBrokerService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: ServletService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: RunDataService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: PoolService
  [Wed May 30 16:34:52 EDT 2001] -- INFO -- Shutting down service: FactoryService
  [Wed May 30 16:34:53 EDT 2001] -- INFO -- Start Initializing service (late): 
SecurityService
  [Wed May 30 16:34:53 EDT 2001] -- INFO -- Finish Initializing service (late): 
SecurityService
  [Wed May 30 16:34:53 EDT 2001] -- INFO -- Start Initializing service (late): 
PoolBrokerService
  [Wed May 30 16:34:53 EDT 2001] -- INFO -- Finish Initializing service (late): 
PoolBrokerService
  [Wed May 30 16:34:53 EDT 2001] -- INFO -- Start Initializing service (late): 
MapBrokerService
  [Wed May 30 16:34:53 EDT 2001] -- INFO -- Finish Initializing service (late): 
MapBrokerService
  
  Revision  Changes    Path
  1.24      +24 -4     
jakarta-turbine/src/java/org/apache/turbine/services/BaseServiceBroker.java
  
  Index: BaseServiceBroker.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/BaseServiceBroker.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- BaseServiceBroker.java    2001/05/26 00:54:30     1.23
  +++ BaseServiceBroker.java    2001/05/30 20:54:15     1.24
  @@ -54,6 +54,7 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Iterator;
  @@ -79,7 +80,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Kevin Burton</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
  - * @version $Id: BaseServiceBroker.java,v 1.23 2001/05/26 00:54:30 dlr Exp $
  + * @version $Id: BaseServiceBroker.java,v 1.24 2001/05/30 20:54:15 jvanzyl Exp $
    */
   public abstract class BaseServiceBroker
       extends BaseInitableBroker
  @@ -245,11 +246,30 @@
       public void shutdownServices( )
       {
           notice("Shutting down all services!");
  -        Enumeration serviceNames = mapping.keys();
  +        
  +        Iterator serviceNames = mapping.getKeys();
           String serviceName = null;
  -        while (serviceNames.hasMoreElements())
  +        
  +        /*
  +         * Now we want to reverse the order of
  +         * this list. This functionality should be added to 
  +         * the ExtendedProperties in the commons but
  +         * this will fix the problem for now.
  +         */
  +        
  +        ArrayList reverseServicesList = new ArrayList();
  +        
  +        while (serviceNames.hasNext())
  +        {
  +            serviceName = (String)serviceNames.next();
  +            reverseServicesList.add(0, serviceName);
  +        }
  +        
  +        serviceNames = reverseServicesList.iterator();
  +        
  +        while (serviceNames.hasNext())
           {
  -            serviceName = (String)serviceNames.nextElement();
  +            serviceName = (String)serviceNames.next();
               notice("Shutting down service: " + serviceName);
               shutdownService(serviceName);
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to