Jason van Zyl <[EMAIL PROTECTED]> writes:
> On 10/1/01 8:06 PM, "Daniel Rall" <[EMAIL PROTECTED]> wrote:
>
>> Shouldn't the {init,shutdown}Service(String) methods be sync'd to
>> avoid problems in a multi-threaded environment?
>
> Should we consider it the job of the application using fulcrum to make sure
> that these methods only get called once. We should definitely document it.
>
> I haven't given it much thought, I'm just going through all the patches :-)
I need to be able to startup and shutdown inidividual services at
will, and would rather have the mechanism for doing so be thread-safe.
I checked in this patch a while back, but as always am open to
comments and revision.
>> Index: BaseServiceBroker.java
>> ===================================================================
>> RCS file:
>> /home/cvs/jakarta-turbine-fulcrum/src/core/java/org/apache/fulcrum/BaseService
>> Broker.java,v
>> retrieving revision 1.9
>> diff -u -u -r1.9 BaseServiceBroker.java
>> --- BaseServiceBroker.java 2001/10/01 23:55:38 1.9
>> +++ BaseServiceBroker.java 2001/10/02 00:02:54
>> @@ -441,7 +441,7 @@
>> * @exception InitializationException Initilaization of this
>> * service was not successful.
>> */
>> - public void initService(String name)
>> + public synchronized void initService(String name)
>> throws InitializationException
>> {
>> String className = (String) mapping.get(name);
>> @@ -483,7 +483,6 @@
>> * after one service fails, the other will not have the chance
>> * to initialize.
>> *
>> - * @param data An Object to use for initialization activities.
>> * @param report <code>true</code> if you want exceptions thrown.
>> */
>> public void initServices(boolean report)
>> @@ -562,7 +561,7 @@
>> *
>> * @param name The name of the <code>Service</code> to be uninitialized.
>> */
>> - public void shutdownService(String name)
>> + public synchronized void shutdownService(String name)
>> {
>> String className = (String) mapping.get(name);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]