You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Edgar González <eg...@valhallaproject.com> on 2002/07/22 21:02:25 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>


Re: [PATHC]Turbine 2.2b2 not shutdown Fulcrum services

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
=?iso-8859-1?Q?Edgar_Gonz=E1lez?= <eg...@valhallaproject.com> writes:

>Ok Henning,

>But just for curiosity, how do you plan to make a generic Component Service,
>if Torque and Fulcrum only implement the Stratum interfaces:
>- Initializable
>- Configurable

>and these interfaces just provide the methods:
>- Initializable.initialize
>- Configurable.configure

ATM it is about starting up (It works now, BTW :-) but you're right, neither
Torque nor Fulcrum implement Disposable yet. Which shouldn't be too hard to
add and I will make Disposable an optional property for the service.

>Or are you planning to modify Torque and Fulcrum

To get orderly shutdown, this will be necessary, yes. For simply starting
it up, there is no need to do so.

(Service Startup in Turbine-2 is a mess. Hacks on top of hacks on top
of band-aids. There are about three different ways needed to start up
services (Really, really early by TurbineServices.initClass (Resources
and Logging), early (mapping is available at init() time and late
(lazy)). This is one thing, where a cleanup for post-T2.2 is really
necessary. Fulcrum seems to get this right.

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

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


Re: [PATHC]Turbine 2.2b2 not shutdown Fulcrum services

Posted by Edgar González <eg...@valhallaproject.com>.
Ok Henning,

But just for curiosity, how do you plan to make a generic Component Service,
if Torque and Fulcrum only implement the Stratum interfaces:
- Initializable
- Configurable

and these interfaces just provide the methods:
- Initializable.initialize
- Configurable.configure

Or are you planning to modify Torque and Fulcrum

----------------------------------------------------------------------------
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

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

----- Original Message -----
From: "Henning P. Schmiedehausen" <hp...@intermeta.de>
Newsgroups: hometree.jakarta.turbine.dev
To: <tu...@jakarta.apache.org>
Sent: Monday, July 22, 2002 4:20 PM
Subject: Re: [PATHC]Turbine 2.2b2 not shutdown Fulcrum services


> =?iso-8859-1?Q?Edgar_Gonz=E1lez?= <eg...@valhallaproject.com> writes:
>
> >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.
>
> -1 on this patch.
>
> I'm currently working exactly at this point to replace the Component
> stuff with a generic ComponentService. But please, don't hardcode
> Fulcrum and Torque here. The Component init in Turbine.java is an ugly
> wart that will be gone RSN.
>
> Stay tuned, this should work tomorrow.
>
> Regards
> Henning
>
>
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
> INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de
>
> Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
> D-91054 Buckenhof     Fax.: 09131 / 50654-20
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>


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


Re: [PATHC]Turbine 2.2b2 not shutdown Fulcrum services

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
=?iso-8859-1?Q?Edgar_Gonz=E1lez?= <eg...@valhallaproject.com> writes:

>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.

-1 on this patch.

I'm currently working exactly at this point to replace the Component
stuff with a generic ComponentService. But please, don't hardcode
Fulcrum and Torque here. The Component init in Turbine.java is an ugly
wart that will be gone RSN.

Stay tuned, this should work tomorrow.

	Regards
		Henning



-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

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