You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Stefano Turri <st...@interfree.it> on 2005/09/08 23:04:46 UTC
Threaded Service - hivemind BuilderFactory with constructor parameters
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