Hi!


I am developing a "standalone" Swing Application and trying to make use of CDI 
(using openwebbeans). Also for being more fit when discussing Orchestra 
related things :-)





Naturally a Swing Application consists of multiple threads. At least the main 
thread and the so called Event Dispatcher Thread (EDT) for UI handling.

Beside this you will find a lot of other short-time threads handling actions 
triggered by the user through the UI.



The problem I have is the org.apache.webbeans.spi.se.DefaultContextsService 
class which uses ThreadLocals to store all the contexts.



I think this is not right, at least not for all the contexts provided.

For example the ApplicationContext, SessionContext, SingletonContext and 
DependentContext should be a simple member of the class. Not sure about (CDI 
like) ConversationContext.

The RequestContext might be arguable to life with the Thread - however, the 
developer need to take care to destroy the RequestContext manually somehow - 
or something we can implment into the Swing Application Framework.



For now I solved that by providing my own ContextsService impl through 
openwebbeans.properties.





Also, like in Weld, I'd love to see some utility class to startup CDI in an 
standalone app. Once you figured out it is easy already, but it can be even 
more easy, and we can provide some predefined events like ContainerInitialized 
[1].





Said that (and given my observations are correct), what do you think about 
starting up a webbeans-se module where we put these things together?

It won't grow to a huge project, though.



Ciao,

Mario



[1] 
http://www.jarvana.com/jarvana/view/org/jboss/weld/weld-se/1.0.0-CR2/weld-se-1.0.0-CR2-javadoc.jar!/org/jboss/weld/environment/se/events/ContainerInitialized.html

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to