You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Edgar González <eg...@valhallaproject.com> on 2002/07/22 20:36:04 UTC

[PATHC]Turbine 2.2b2 not shutdown Fulcrum services

Hi,

Working in a Quartz (schedule) service based in Fulcrum I found that Turbine
2.2b2 not shutdown neither Fulcrum services or Torque.

This patch get references to Fulcrum and Torque during initialization (if
they are present), and in Turbine.destroy() make a shutdown to Fulcrum
services and Torque.

----------------------------------------------------------------------------
Edgar Gonzalez Gonzalez
VALHALLA Project, s.a.
Chief Technology Officer
Web: www.valhallaproject.com
E-mail: egg@valhallaproject.com
Phone: +58-212-242.4379 / 6662 / 4055 / 6475
Fax: +58-212-242.6809

"The limits of my language mean the limits of my world."
Ludwig Wittgenstein

----------------------------------------------------------------------------

Index: Turbine.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-2/src/java/org/apache/turbine/Turbine.java,v
retrieving revision 1.19
diff -u -r1.19 Turbine.java
--- Turbine.java 11 Jul 2002 14:28:29 -0000 1.19
+++ Turbine.java 22 Jul 2002 18:27:42 -0000
@@ -171,6 +171,13 @@
     private static String contextPath;

     /**
+     *  References to Torque and Fulcrum components if they are used.
+     */
+    private static org.apache.fulcrum.Fulcrum fulcrumComponent;
+    private static org.apache.torque.Torque torqueComponent;
+
+
+    /**
      * This init method will load the default resources from a
      * properties file.
      *
@@ -234,7 +241,23 @@
                 // Initialize components like torque and fulcrum
                 ComponentLoader loader = new ComponentLoader(
                         TurbineResources.getConfiguration());
-                loader.load();
+                // Get references to Torque and Fulcrum
+                // in order to shutdown properly in method destroy().
+                Object[] components = loader.load();
+                if (components != null)
+                {
+                    for(int i=0; i< components.length; i++)
+                    {
+                        if ( components[i] instanceof
org.apache.torque.Torque )
+                        {
+                            torqueComponent =
(org.apache.torque.Torque)components[i];
+                        }
+                        else if ( components[i] instanceof
org.apache.fulcrum.Fulcrum )
+                        {
+                            fulcrumComponent =
(org.apache.fulcrum.Fulcrum)components[i];
+                        }
+                    }
+                }

                 log ("Turbine: init() Ready to Rumble!");
             }
@@ -344,6 +367,16 @@
      */
     public final void destroy()
     {
+        // Shut down Fulcrum Services
+        if (fulcrumComponent != null)
+        {
+            fulcrumComponent.shutdownServices();
+        }
+        // Shut down Torque
+        if (torqueComponent != null)
+        {
+            torqueComponent.shutdown();
+        }
         // Shut down all Turbine Services.
         TurbineServices.getInstance().shutdownServices();
         System.gc();



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