Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7954913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:34:37+00:00 2026-06-04T03:34:37+00:00

In my current application, I’ve run into this pattern in a couple of places:

  • 0

In my current application, I’ve run into this pattern in a couple of places: I have two service interfaces in a single bundle which do different but related jobs.

interface Service1 { ... }

interface Service2 { ... }

and want to have singleton components implementing both, but find each needs a reference to the other:

public class Service1Impl implements Service1 { 

    private Service2 service2;
    ...

}

public class Service2Impl implements Service2 { 

    private Service1 service1;
    ...

}

Which of the three OSGi component models (DS, Blueprint, and iPOJO) allow this: 1) when Service1Impl and Service2Impl are in the same bundle; 2) when they are in different bundles?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:34:39+00:00Added an answer on June 4, 2026 at 3:34 am

    Declarative Services Specification, version 1.1:

    112.3.5 Circular References

    It is possible for a set of component descriptions to create a circular dependency. For example, if
    component A references a service provided by component B and
    component B references a service provided by component A then a
    component configuration of one component cannot be satisfied without
    accessing a partially activated component instance of the other
    component. SCR must ensure that a component instance is never
    accessible to another component instance or as a service until it has
    been fully activated, that is it has returned from its activate method
    if it has one.

    Circular references must be detected by SCR when it
    attempts to satisfy component configurations and SCR must fail to
    satisfy the references involved in the cycle and log an error message
    with the Log Service, if present. However, if one of the references in
    the cycle has optional cardinality SCR must break the cycle. The
    reference with the optional cardinality can be satisfied and bound to
    zero target services. Therefore the cycle is broken and the other
    references may be satisfied.

    Blueprint specification explicitly allows this, provided at least one member of the dependency cycle takes others as properties and not arguments (121.2.6 Cyclic Dependencies):

    When a member of a cycle is requested to provide a component instance,
    the Blueprint Container must break the cycle by finding one breaking member in the cycle’s members. A breaking member must use property injection
    for the dependency that causes the cycle. The Blueprint Container can pick
    any suitable member of the cycle for breaking member, if no such member
    can be found, then initialization fails or the getComponentInstance
    method must throw a Component Definition Exception.

    A breaking member must return a partially initialized component instance
    when it is asked to provide an object. A partially initialized object has done
    all possible initialization but has not yet been called with the initMethod (if
    specified) nor has it been injected any of the properties that causes a cycle.
    The finalization of the partially initialized component instance must be
    delayed until the breaking member has been injected in all referring members of the cycles. Finalization means injecting any remaining unset properties and calling of the initMethod, if specified.

    The consequence of partially initialized component instances is that they
    can be used before they have all properties set, applications must be aware
    of this.

    All partially initialized component instances must be finalized before the
    Blueprint Container enters the Runtime phase and before a call to the
    getComponentInstance method returns a component instance. User code
    that causes a dynamic cycle by recursively calling the
    getComponentInstance method must be detected and cause a failure, these
    cycles cannot be broken.

    All detected cycles should be logged.

    For iPOJO

    Your specific situation is supported. I can’t talk for other situations
    without knowing further description though.

    (answer received on the mailing list).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my current application I have this little animation. It makes a full 360
My current application is something like this: I have an application deployed on Apache
In my current application I have a main form: frmMain with a statusstrip and
A common scenerio we are running into with our current application is where we
In my current application in payment gateway, I want to perform this steps Transfer
I'm deserializing some XML from an old application into an object in my current
In the current application I am working on I have a custom ControllerFactory class
I have several TableViews in my current application and I'd like to have a
In my current application, I need to be able to do this type of
In iOS4, users are able to leave the current application and put it into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.