Hi Peter, Am Mittwoch, den 10.11.2010, 06:23 +0200 schrieb Peter Lauri: > Hi, > > We have developed a few OSGI components that are publishing/consuming > services. However, we have one issue that we don't know the best design of. > > Bundle A is consuming a service that Bundle B is providing. The service of B > depends on configurations in a directory (xml files) and will be registered > when it gets a ManagedService.updated call. Assume we reconfigure the system, > that means new xml/modified files ends up in the directory and we manually > refresh the configuration bundle => ManagedService.updated is called. > Meanwhile this configuration changes are read up, the service should not be > usable. So there are two possibilities as I see it (or are there more?): > > Option A: We keep the service registration, but make sure that calls to the > service cannot be performed meanwhile configurations are read up (internal > synchronization). > Option B: We unregister the service, read configuration, register the service > again. The consumer then need to track this removedService it self. > > What is the best pattern here? Any general recommendations? Is there any good > Option C?
IMHO opinion both options are viable and the actual choice you take depends on how easy and stable one or the other option may be implemented. One point, though: Consumers of services must *always* be prepared that services go away, no matter what reason. So regardless of your choice of option, the consumer must correct track service unregistration. Regards Felix > > /Peter > > > > _______________________________________________ > OSGi Developer Mail List > [email protected] > https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
