Suppose BundleA is having depenedancy with BundleB and also BundleB is having dependancy on BundleA. So how this dependencies will be resolved . And when and how will this bundles be started
FYI: Just had a curiosity to know.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @ashwinka,
TBH I have no idea how this is/would work, but having cyclic dependencies is never a good idea. In that case, I would strongly suggest refactoring the code.
Good luck,
Daniel
Hi @ashwinka,
TBH I have no idea how this is/would work, but having cyclic dependencies is never a good idea. In that case, I would strongly suggest refactoring the code.
Good luck,
Daniel
In OSGi, when two bundles have circular dependencies (e.g., BundleA depends on BundleB, and BundleB depends on BundleA), the resolution depends on how the OSGi Service Component Runtime (SCR) manages service registration and injection. OSGi uses a dynamic service model, meaning that services can be published and consumed dynamically, helping to resolve circular dependencies to some extent.
Here’s how the circular dependency is handled:
Lazy Loading: OSGi services can be declared with lazy activation (Bundle-ActivationPolicy: lazy
). This means a bundle is only activated when one of its services is actually used. This can help in managing circular dependencies because a service may not be activated until the dependent service is available.
Service References: Declarative Services (DS) allow bundles to declare references to other services using @reference
. The SCR manages these references and can dynamically bind services once they become available. If both services depend on each other, OSGi resolves this lazily, activating the services when needed.
Please check
https://issues.apache.org/jira/browse/FELIX-6724
I know this
Service References: Declarative Services (DS) allow bundles to declare references to other services using @reference. The SCR manages these references and can dynamically bind services once they become available. If both services depend on each other, OSGi resolves this lazily, activating the services when needed.
will work but good luck writing test cases for it, I had similar issue
I don't think that this will work at all, in the end the bundle dependencies need to form a directed tree, and not a graph with cycles.
Views
Likes
Replies
Views
Likes
Replies