You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Karthi Prabhakaran <ka...@yahoo.com> on 2005/08/06 17:50:43 UTC
Circular dependency
Hi, I have a design in which the services reference
each other. And the instantiation fails. Can this be
made to work or should I change the
design?
Here's how my descriptor looks:
<?xml version="1.0" ?>
<module id="blah.app" version="1.0.0"
package="com.blah">
<service-point id="GetStatus"
visibility="private"
interface="com.blah.service.Status"/>
<service-point id="Gateway"
interface="com.blah.gateway.GatewayService"/>
<implementation service-id="GetStatus">
<create-instance
class="com.blah.service.impl.StatusImpl"/>
</implementation>
<implementation service-id="Gateway">
<invoke-factory>
<construct
class="com.blah.gateway.impl.TIBGatewayStub"
initialize-method="initialize"/>
</invoke-factory>
</implementation>
</module>
The gateway service implementation has a reference to
StatusImpl and a GatewayService.listen () uses that by
doing a Status.perform(). Now,
Status.perform() after it is done, uses a
GatewayService.send() to send back its results out.
To achieve that I started to have an instance of
GatewayService in StatusImpl. Hence, the circular
reference. The GatewayService implementation s
instantiated first.
Should I solve the problem differently? This seemed
cleaner to me as opposed to passing around a Registry
reference to lookup the GatewayService again.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org