2009/6/10 jgunz <[email protected]> > > I'm trying to register a service in a thread spawned from an > Activator.start() method but the call is deadlocking. If I make the same > calls within the start() thread it works fine. Should the following work? > > public void start(final BundleContext bundleContext) throws Exception > { > Thread bundleStartupThread = new Thread(new Runnable(){ > public void run() > { > Hashtable properties = new Hashtable(); > properties.put( > Constants.SERVICE_PID, > "foo.bar"); > bundleContext.registerService(Integer.class.getName(), > new Integer(4) , properties); > > } > }); > > bundleStartupThread.start(); > } >
I just pasted that exact code into a bundle and tried it out with a recent version of Felix and didn't see any deadlock - what version of Felix are you using, and also could you take a thread-dump when you get the hang and send it to the list? Use Ctrl-Brk on Windows, Ctrl-\ on Linux if you have access to the console window, otherwise for Java 5 or later you can use the "jstack" utility that ships with the JDK: jstack -l <pid> HTH > -- > View this message in context: > http://www.nabble.com/Deadlock-registering-service-tp23947039p23947039.html > Sent from the Apache Felix - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Cheers, Stuart

