[ http://issues.apache.org/jira/browse/HIVEMIND-155?page=comments#action_12356788 ]
Knut Wannheden commented on HIVEMIND-155: ----------------------------------------- James, "Support" is probably the wrong term. But it's certainly not nice to have HiveMind enter an endless loop trying to construct this service. I think it would make sense if HiveMind detected this and reported an error. What do you think? > Infinite Recusion Issue When Creating a Service > ----------------------------------------------- > > Key: HIVEMIND-155 > URL: http://issues.apache.org/jira/browse/HIVEMIND-155 > Project: HiveMind > Type: Bug > Components: framework > Versions: 1.1 > Environment: Windows XP > Reporter: Jean Safar > > I am experiencing a problem by which HiveMind (version 1.1 and 1.1-beta-3) > will enter into a infinite recursion when creating a service. This eventually > exhausts all the available memory and makes the program unusable. > > I have a Service Class MyService implementing the interface IMyService. > > This class has a constructor public MyService (IMyService) {...} as well as > other constructors. > > The service point of my service has no parameters or explicit injection via > <set-service. > > When creating the service, it will eventually arrive at a the following test > within the method instantiateCoreServiceInstance in BuildFactoryLogic. > > if (_parameter.getAutowireServices() && parameters.isEmpty()) > { > return instantiateConstructorAutowiredInstance(serviceClass); > } > > This test will be satisfied and the instantiateConstructorAutowiredInstance > will then be called. > > In it will try and get all the constructors for the given class removing > those not taking interfaces as parameters. > > List serviceConstructorCandidates = > getOrderedServiceConstructors(serviceClass); > > One of this constructor will be the one with IMyService in it. If with bad > luck it comes first in the iteration that follows, the code will try and call > the constructor with parameters which are services attached to the interfaces > of the parameters. > > Since the interface is the very interface of the service I am trying to > build, it will enter the loop and never come back. > > An easy and effective fix might be to disregard constructors with the > interface of the service it is currently trying to build thus avoiding the > loop. I have tried that and it works fine. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]