I'm using iPOJO. The proposed fix that I outlined in the first message in this thread is also complaining about a cycle but is not consistent about it.
On Wed, Aug 13, 2014 at 2:04 PM, David Jencks < [email protected]> wrote: > Which technology (DS? dependency manager? ipojo?) are you using? which > version? I'd guess not DS since I don't recognize the @Service annotation. > > For DS, without looking closely at your situation, (1) sometimes whether > there appears to be a circular dependency depends on which order the > components start and the reference cardinalities. and (2) when there are > enough optional dynamic dependencies we try to go back later to establish > references that could not be established the first time through. > > thanks > david jencks > > On Aug 13, 2014, at 12:50 PM, Dean Schulze <[email protected]> > wrote: > > > I have the following class structure which works: > > > > C1 <>------ C2 <>-------- C3 ------<> C4 > > > > The <> is supposed to be a UML filled diamond denoting object > composition. > > These are @References to other Services. > > > > If I then add a @Reference to C1 in C4 I get a cycle: > > > > C1 <>------ C2 <>-------- C3 ------<> C4 <>-- > > | | > > |_________________________________ | > > > > > > Sometimes on startup I'll get an Exception saying > > "ServiceFactory.getService() resulted in a cycle", but other times the > > application starts up and runs without any problems. > > > > Is there something I can do to make this behave consistently? If it is > > supposed to throw an Exception it should do it every time, not > > inconsistently. > > > > My second question is if I can fix this by dropping the @Reference that > C4 > > has to C3 and having C4 get a (lower case) reference to C3 by going > through > > C1 and C2 with getter methods like this: > > > > > > C1 <>------ C2 <>-------- C3 C4 <>-- > > | | > > |_________________________________ | > > > > > > Are there any problems getting the @Reference that C2 had to C3 like > this: > > > > @Service > > public class C2 { > > > > private @Reference IC3 c3; > > IC3 getC3Reference() {return c3;} > > } > > > > where IC3 is the interface for Service C3. > > > > Thanks. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >

