-
Oct 13th, 2009, 02:44 AM
#1
Mandatory Service (cardinality) only during init and not at runtime ?
The parameter cardinality equal to 1:1 takes effect only during initialization.Why is this not reflected at runtime ?
Example:
Bundle A - exposes service
Bundle B- Imports service with cardinality 1:1
Now if i deploy bundle B first without Bundle A it waits for the timeout and then errors out . This is expected.
Assume teh second case where
I deploy Bundle A .then deploy Bundle B .Everything works fine. Now if i undeploy Bundle A
I expect Bundle B to fail since its a mandatory service . Isnt this the expectation ?
Instaed currently it waits for timeout and then throws a service unavailable Exception.
-
Oct 13th, 2009, 10:22 AM
#2
Is the second case, OSGi service was published by bundle A and found by bundle B. So bundle B application context is properly constructed and available.
Service is published as a proxy that dynamically looks up proper service reference to invoke during runtime. From a perspective of bundle B - services/bean is there and available.
OSGi service registry is a very dynamic animal, you have to be aware that services can come and go at any time.
Is you really have to shutdown bundle b is service a is going away, you can do that with a service listener. That service listener should implement BundleContextAware - and you can call bundleContext.getBundle().update() to hopefully refresh the bundle and potentially stop spring context from starting up.
Here is some reference: http://static.springsource.org/osgi/...:refs:dynamics
Thanks
Dmitry
-
Oct 13th, 2009, 11:30 AM
#3
I knew about the listener functionality , but was just confirming about the expected behaviour as i was confused by the word "mandatory" service . So now "mandatory at initilization" is a better word to associate.
Thankz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules