I agree, the sleeping thing was only a temporary solution. A similar issue appears in ShindigRegistrationServiceImpl. The issue here is that the Guice injector needs to be initialized (instantiate and set an attribute for it onto the servletcontext) before registering any other Shindig servlets. The Guice injector however is initialized by another (fake) servlet registration, and you don't 'know' when that servlet is 'available'. I guess a proper solution could be that the fake servlet registers some 'GuiceInjector' service on which the servlet registration defines a service dependency.
Regards, Ivo -----Original Message----- From: amdatu-developers-bounces at amdatu.org [mailto:[email protected]] On Behalf Of Marcel Offermans Sent: donderdag 7 oktober 2010 10:32 To: amdatu-developers at amdatu.org Subject: Re: [Amdatu-developers] Usage of configurations That's exactly the direction I was thinking about: in a dynamic environment you can never rely on something being available, nor can you just "sleep for a while" hoping that that will be long enough for whatever you depend on to show up. Explicitly modelling your dependencies (service and configuration) is the best option you have. Greetings, Marcel On 7 Oct 2010, at 10:21 , Angelo van der Sijpt wrote: > Hi Ivo, > > Well, the ManagedService interface is intended for exactly the situation in > which you don't know when a configuration shows up, but you _do_ need it; you > can read all about it in the OSGi Compendium, section 104. > The DependencyManager has a mechanism to declare a dependency on a > configuration, which should be used in this case. > > Angelo > > On Oct 7, 2010, at 9:10 AM, Ivo Ladage-van Doorn wrote: > >> Hi Angelo, >> >> The Thread.sleep construction in ConfigTemplateManager was necessary using >> fileinstall. Using fileinstall you never know when your configuration is >> 'present' (deployed). But doesn't apply the same issue to the new central >> configuration bundle approach? >> Since the ConfigTemplateManager and central config bundle have no >> dependency, you need a mechanism to ensure that the configuration is added >> to config admin before the ConfigTemplateManager service is started (the >> ConfigTemplateManager needs the config for initialization). >> I guess we could fix this using service dependencies with filters, like we >> did for Cassandra and ColumnFamilies being available. In general we will >> need a mechanism to ensure that your service is started only when the >> configuration that belongs to the bundle that holds the service is available >> in config admin. >> >> Regards, Ivo >> >> -----Original Message----- >> From: amdatu-developers-bounces at amdatu.org >> [mailto:amdatu-developers-bounces at amdatu.org] On Behalf Of Angelo van der >> Sijpt >> Sent: woensdag 6 oktober 2010 20:19 >> To: amdatu-developers at amdatu.org >> Subject: [Amdatu-developers] Usage of configurations >> >> Hi list, >> >> As I mentioned earlier, a number of services use Config Admin in a peculiar >> way; I believe this might be responsible for the problems I sometimes see >> when updating bundles in a running system. A typical example is >> ConfigTemplateManagerImpl, which sleeps while waiting for its configuration >> to show up. >> >> It will probably be best to refactor this in one fell swoop, but we should >> first identify the places where this is relevant. If the list agrees, I will >> go ahead and create a Jira issue which we can use to compile these places. >> >> Angelo >> _______________________________________________ >> Amdatu-developers mailing list >> Amdatu-developers at amdatu.org >> http://lists.amdatu.org/mailman/listinfo/amdatu-developers >> >> _______________________________________________ >> Amdatu-developers mailing list >> Amdatu-developers at amdatu.org >> http://lists.amdatu.org/mailman/listinfo/amdatu-developers > > > _______________________________________________ > Amdatu-developers mailing list > Amdatu-developers at amdatu.org > http://lists.amdatu.org/mailman/listinfo/amdatu-developers _______________________________________________ Amdatu-developers mailing list Amdatu-developers at amdatu.org http://lists.amdatu.org/mailman/listinfo/amdatu-developers

