geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan <>
Subject Decouple OpenWebBeans plugin from web container
Date Sat, 29 Oct 2011 03:32:25 GMT
Hi, devs, in the last week, I am trying to decouple the OpenWebBeans from
web container, and would like to list some major change points, will
appreciate any comment.

Generally speaking, there are three points required to do :
1. Remove the OpenWebBeans hard references from the Holder class in the
geronimo-j2ee module. The Holder class is used to create those managed
classes, like servlet, filter, etc. Now the solution is to introduce a
interceptor interface, like :

public static interface Interceptor {

        public void instancerCreated(InvocationContext context) throws

        public void instanceDestoryed(InvocationContext context) throws

        public void postConstructInvoked(InvocationContext context) throws

With this, other technology could register their own interceptors to the
Holder instance to populate the created instance.

2. Thread aware WebBeansContext
The same solution with JSF plugin is used, now we keep a thread-aware web
application name. Considering to the GeronimoSingletonService is used
globally, I added an extra field below. While the getContext method is
invoked, it will firstly check whether there is WebBeansContext attached
with the current thread, then it will check whether there is one found based
on the web application name.
private SingletonService<WebBeansContext> webApplicationSingletonService;

3. OpenWeBeans initialization
This is a tricky thing, in the past, we initialize it in the related
webAppContext, with that, it would make sure the WebBeansContext is
initialized before any managed instances are created, including the
Now I created a WebModuleListener, which is internally used by Geronimo, it
is similar with the ServletContextListener, but this listener will be called
after the ServletContext is created and before any managed instances are

A patch is attached the JIRA below, I have run some cases, including parts
of Java EE TCK cases and all the JCDI cases, the results looked fine.

View raw message