hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Turri <stefanotu...@interfree.it>
Subject Threaded Service - hivemind BuilderFactory with constructor parameters
Date Thu, 08 Sep 2005 21:04:46 GMT
Hi all,

I've been using hivemind-1.1-alpha-1 for some time, and just recently 
I've started the upgrade to beta 3, encountering the following problem:

In alpha-1 i had a threaded service ("holder" service in the example 
below) that used hivemind.BuilderFactory <object/> in order to retrieve 
some parameters (Thread dependent) for the constructor. A different 
implementation object was created for each thread, and each object 
retrieved a different parameter using "service-property" object provider 
("generator" service).

In beta-3 a different implementation object is created for each thread, 
but the "service-property" is retrieved only once, when the first object 
is created. So all thread use the value generated while initializing the 
first object.

I've also tried with hivemind 1.0 and the behavior is the same of 
beta-3, so can i assume that this is the correct behavior?
Is there another way to bind different values of constructor Parameters 
for each different executing thread ?

NOTE: the first service implementation is not in the same codebase of 
the service providing the property, so it's not easy to change the code 
in order to inject a dependency to the other service

Thanks
Stefano

-----------------------------
Mi service configuration is something like this:


<?xml version="1.0"?>
<module id="hive" >

    <!-- This is the service that must retrieve configuration -->
    <service-point id="holder" interface="hive.KeyHolder">
        <invoke-factory model="threaded">
            <construct  class="hive.ThreadedKeyHolder">
                <object>service-property:generator:nextKey</object>
            </construct>
        </invoke-factory>
    </service-point>

    <service-point id="generator" interface="hive.KeyGenerator">
        <invoke-factory model="threaded">
        <!-- This class has method that returns different values for 
each thread -->
            <construct class="hive.KeyGeneratorImpl"/>
        </invoke-factory>
    </service-point>

</module>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message