I'm starting to use OSGi and I'm a little "noob" in the bussiness.
My problem is the next;
I have a bundle that I need to be singleton, because it must be accessed by another two bundles at the same time; I mean, two different bundles are going to use it, and when one of them modifies some of the values inside the first bundle, the change must be seen by the second bundle.
I'm working with Eclipse and in the manifest.mf file there's an option to make the bundle singleton, but I don't know if that's working.
I explain: To probe if the bundle is singleton, I used the option in the manifest.mf file to make "plug-in as singleton". Then, I inserted a new property inside the first bundle(the one that must be singleton). The property is just an String, message, who's default value is "Not altered".I also implemented two function, setMessage(String) and getMessage.
Well, with the second bundle I modify the value to "Altered by bundle2". But when I read the value with bundle3, the message value is ALWAYS "Not altered" , UNLESS I set Message as STATIC.
My doubt is the next; When I put Message as static, it always works. I modify the value and when I read it , it writes "Altered by bundle2", perfect. But that works always, even If I don't choose the "this plug-in as singleton" option in the manifest.mf file. It seems that it doesn't care if I mark it as singleton if I just put static in the property.
But this way I don't know if it's really a singleton or what. It doesn't make sense to me... does this mean that if I want the actualized values of the properties I need to mark them as static, and nothing else?
I attach an Image because my english is soooo poor and I don't know if I explain correctly what I want to do.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
-Mike Kapnisakis, Warner Bros
With your subscription - you'll gain access to our exclusive IT community of thousands of IT pros. You'll also be able to connect with highly specified Experts to get personalized solutions to your troubleshooting & research questions. It’s like crowd-sourced consulting.
We can't always guarantee that the perfect solution to your specific problem will be waiting for you. If you ask your own question - our Certified Experts will team up with you to help you get the answers you need.
Our certified Experts are CTOs, CISOs, and Technical Architects who answer questions, write articles, and produce videos on Experts Exchange. 99% of them have full time tech jobs - they volunteer their time to help other people in the technology industry learn and succeed.
We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed.