Rafal Krzewski <[EMAIL PROTECTED]> writes:

> Daniel Rall wrote:
> 
> > I believe that the TurbineServices ServiceBroker implementation should
> > only allow initialization once.  I propose this patch to it:
> <snip>
> > It's possible that initServices() should take a Object instead of a
> > ServletConfig parameter.
> 
> Unfortunately, it's not that simple. It is perfectly valid to call
> broker's initSerices() method multiple times, passing *different*
> objects into it. The serices that return true from getInit()
> will not have their init(Object) methods invoked. On the other
> hand, services are free to ignore init(Object) if they don't
> care for a particular class or instance of the passed Object.
> 
> So, -1 on the patch. This is not the way of solving the problem.

Okay, that is reasonable (though I don't plan on using that feature
;).  How about just synchronizing on TurbineServices--I can't see that
overlapping service initializations would be good thing anyhow.

Daniel


Index: TurbineServices.java
===================================================================
RCS file: 
/products/cvs/turbine/turbine/src/java/org/apache/turbine/services/TurbineServices.java,v
retrieving revision 1.8
diff -u -u -r1.8 TurbineServices.java
--- TurbineServices.java        2000/12/14 22:24:59     1.8
+++ TurbineServices.java        2000/12/14 23:20:14
@@ -125,6 +125,16 @@
     }
 
     /**
+     * Initializes brokered services.
+     *
+     * @param config Service configuration information.
+     */
+    public synchronized void initServices (Object config)
+    {
+        super.initServices(config);
+    }
+
+    /**
      * Creates a mapping between Service names and class names.
      *
      * The mapping is built according to settings present in


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to