views:

49

answers:

1

I have an OSGi target platform consisting of Equinox, the Spring Framework, Spring DM, and several custom bundles for my application. All of my bundles contain Spring application contexts and so are automatically loaded by the Spring OSGi extender.

Some of my bundles contain Swing ui components. The problem is that the Spring OSGi Extender does not create these application contexts on the AWT EventQueue which results in several ui issues.

The only workaround I've found so far is to create a fragment bundle for the spring-osgi-extender and configure the "taskExecutor" as mentioned here. Basically my custom taskExecutor implementation forwards all execute() calls to the AWT EventQueue. This is not really a good solution since ALL the Spring-powered bundles in my application will be created on the AWT thread, slowing down the ui at start-up (and basically killing our splash screen load status since it's starved of any refresh).

Any ideas about how to create those Spring/Swing bundles on the AWT EventQueue?

+1  A: 

I don't have a direct answer to your question, but the following project should help you to figure it out. http://max-server.myftp.org/trac/pm

eugener
I actually found that project shortly after posting the question. It's nice example of an OSGi Swing application, however, it doesn't use the Spring extender to create its Spring/Swing bundles on the AWT EventQueue. It uses a less elegant approach in which all Swing classes wrap their initialization in Runnables and then invoke it on the AWT thread. I have many Swing classes that would need this copy/paste code in their constructors. So not a very feasible solution.
Mr.Marbles