After a very quick read of your mail, a quick try: ServiceHooks (look in the OSGi Core Spec. 4.2) may be something of interest for you. Toni
On Mon, Mar 29, 2010 at 10:00 AM, Leon668 <leon...@gmail.com> wrote: > Hi all, > > I am trying to build a mechanism that is similar to the "Mutex" in OSGI. > Guarantee only one service is only used by one user(service) at one time. > (well, we could expand this to Semaphore) > > I understand OSGI can know which services are referencing to a specific > service. But it looks like we cannot get which services are using a > specific > service. (the services must be actually running) > > > *suppose*. > > Service A is running and it is invoking Service B. > > Then if Service C wants to invoke Service B, it needs to wait until > Service > A releases Service B. > > > > I am trying to build up a management service to record the current service > usage information. ie. whenever one service wants to use the other service, > it always need to check a management service and see if the other service > it > is going to use is available or not. > > I did this by offering a Hashmap in a third party service. The key is the > name of the service(maybe i should pick another property as the name), and > value is the reference to the current service object. Each service checks > this map before it invokes any service. > > I dont know if I am doing the right thing. Maybe OSGI already has this > feature? > > Thanks, > > Leo. > -- Toni Menzel Independent Software Developer Professional Profile: http://okidokiteam.com t...@okidokiteam.com http://www.ops4j.org - New Energy for OSS Communities - Open Participation Software.