[
https://issues.apache.org/jira/browse/FELIX-2923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13023218#comment-13023218
]
David Humeniuk edited comment on FELIX-2923 at 4/22/11 1:39 PM:
----------------------------------------------------------------
The reason this appears to be happening is that ServiceAImpl is a delayed
component that has already been loaded so ServiceA has been resgistered.
However, when another component comes along that needs ServiceA, this causes
ServiceAImpl to be activated. Part of the activation process is to register
ServiceB which immediately causes ServiceCImpl to be activated. A change was
made in FELIX-2368 to immediately activate a component by making most
operations synchronous.
A workaround is to make ServiceAImpl an immediate component which isn't desired
as it shouldn't be activated if nothing needs the service. In this case, the
activation method is completed when the component is loaded and by the time it
is need and bound to another component there is no problem.
was (Author: kmart216):
The reason this appears to be happening is that ServiceAImpl is a delayed
component that has already been loaded so ServiceA has been resgistered.
However, when another component comes along that needs ServiceA, this causes
ServiceAImpl to be activated. Part of the activation process is to register
ServiceB which immediately causes ServiceCImpl to be activated. A change was
made in FELIX-2368 to immediately activate a component by making most
operations synchronous.
A workaround is to make ServiceAImpl an immediate component which isn't desired
as it should be activated if nothing needs the service. In this case the
activation method is completed when the component is loaded and by the time it
is need and bound to another component there is no problem.
> Get a ServiceFactory.getService() resulted in a cycle message when
> registering a service inside a DS activation method
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: FELIX-2923
> URL: https://issues.apache.org/jira/browse/FELIX-2923
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Affects Versions: scr-1.6.0
> Reporter: David Humeniuk
>
> I've run into an issue with Felix SCR where I get the message:
> ServiceFactory.getService() resulted in a cycle
> The reason this appers to be occuring is because within an activation method
> of a service component, call it ServiceAImpl (which provides ServiceA), the
> component registers another service, call it ServiceB.
> I have another service component, call it ServiceCImpl, which depends on both
> ServiceA and ServiceB. When ServiceAImpl registers ServiceB, ServiceCImpl is
> attemted to be activated within the call to activate ServiceAImpl. As part
> of the activation, the ServiceCImpl binding methods are called (at least
> attempted). When the binding method for ServiceA is attempted, the cycle is
> detected and the component fails to initialize.
> I guess what doesn't make sense is why the SCR will activate ServiceCImpl
> within the activation method of ServiceAImpl. I wouldn't think that
> ServiceCImpl would be considered satisfied until after the activation method
> has exited. Perhaps this is an issue of using declarative services while
> still registering services directly with the framework?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira