Pradeep bhatt wrote:What happens when bundle1 dependent on bundle2 is shutdown. Will runtime exception be thrown ? One more question, if changes are made to argument passed to bundle 2 from bundle 1 I guess it wont get reflected in the caller's object, I mean is it similar to RMI calls ?
Regarding your first question, code dependencies are not impacted by whether a bundle is active or not. Once a code dependency is satisfied it will remain satisfied until the framework is shutdown or refreshed. You cannot just go pull the rug out from under a bundle by taking away its required classes. Service dependencies, on the other hand, can go away dynamically and a bundle must be prepared to deal with it. This is similar to distributed programming where remote services can fail for any reason.
Regarding your second question, even though I compare services to distributed computing above, I am only talking about how failure can occur at any time, nothing else. There is nothing special or magical about OSGi services, they are just direct objects shared among bundles and behave just like any normal object would.