cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: EJBInvoker, progress, observations, questions about EJB creation organization, other various questions.
Date Wed, 06 Jul 2011 15:31:22 GMT
Hi Ryan

On Wed, Jul 6, 2011 at 1:27 AM, Ryan Zoerner <ryanzoerner@gmail.com> wrote:
> Hi Sergey,
>
> I am wondering about the 'finally' block in the
> 'public Object invoke(Exchange exchange, Object request)' method of the
> JAXRSInvoker class.
>
> For me, it is line numbers: 113-139.
>
> These lines call the resourceProvider to release the object instance in
> certain cases.

One can configure CXF JAX-RS to use RP to release the instance only
after JAXRSOutInterceptor finalized writing out the response object to
output stream, so this is why you see "if" branch there, but in most
cases, the instance will be released in finally (which is no op really
for singletons).
ResourceProvider also manages the allocation of instances, it's hidden
inside JAXRsInvoker.getServiceObject. The allocation occurs only
initially, no need to do it in case of recursive subresource
invocations.


> Is this something that
> we can exclude from the JAXRSEJBInvoker? Should the bean manage all of its
> lifecycle based on the
> annotation or lifecycle-type (as when declared in xml)?
>
> In the InvokerFactory model, it releases the instance. In that model, the
> invoker plays the role of the resourceProvider
> by containing the Factory.
>

I think it is InvokerFactory which acts exactly as our EJB
ResourceProvider does. JAXWS Invoker simply delegates to
InvokerFactory, JAXRSInvoker will delegate to our custom
ResourceProvider.

Do you agree or do you still see the need to have custom
JAXRSEJBInvoker & custom EJBResourceProvider ? I'm not sure what
JAXRSEJBInvoker will do ?

> I went through the CXFEasyBeansInvoker from easybeans, and compared it with
> the Jonas version, by commenting each
> line or group of lines with their location in the Jonas/CXF version. I think
> that now, we need to:
>
> Get the bean instance from the factory and use java.lang.reflect.Method to
> invoke the method.
>
> After the method is invoked, the bean is released. The InvokerFactory does
> that by way of the Invoker in the Jonas model.
>

Do you mean Invoker asks InvokerFactory to manage the lifecycle ?

> The Jonas model has JAXWSInvoker (with no invoke methods) managing other
> aspects of cleanup during invocation.
>
> The EasyBeansCXFInvoker invoke(w/ 4 params) method, contains, all the way
> down to the exceptionHandling, the essentials
> of the EasyBeans portion of the invocation. The remainder is common to
> AbstractInvoker.
>

Do you think JAXRSEJBInvoker should extend JAXRSInvoker and decorate
the invocation with something similar to what
EasyBeansCXFInvoker does ?

> Right now, then, I am looking at JAXRSInvoker. If
> serverFactory.setResourceClass() won't work, how will we adjust it to allow
> for @Stateless, @Stateful, etc. annotations? I think that it currently
> throws an exception for an unknown annotation.
>

JAXRS server factory does not know about @Stateless, @Stateful, etc.
It is only concerned about JAX-RS annotations.
It is the job of ResourceProvider to handle those annotations -
similarly to the way InvokerFactory does...

> Also, I've noticed that the JContainer3 has a method for creating a factory
> for itself. I am wondering about passing in factories.
> How will the factories be created? How will the IDeployable be created? I
> was thinking about passing that in to the RP and
> creating the factories that way, but maybe it would be better, somehow, to
> create the bean instance somewhere.. where??,
> and pass that into the RP, which can then invoke the JContainer3's start()
> method, which calls createBeanFactories(), which
> calls both createMessageDrivenBeanFactory and createSessionBeanFactory. So,
> passing the bean in, seems to be the,
> now, preferred, method, however, where and how is the bean going to be
> created? Do we declare it as a resourceClass?
> It does not seem to be focused on as being a class, in Easybeans, rather,
> the focus seems to be that of the entire deployable
> package or folder or archive.
>
> So, I am wondering what you think about the idea of passing the bean in and
> using it to start the factory, but am concerned about
> how cxf proposes to deploy this container? Should I be looking at the
> CXF/Jetty (such as cxfServlet) interface and finding out
> how the bean should be deploying through jetty? or are we just going to have
> the bean resource, lifecycle managed by factory,
> sitting alone as accessible through a servlet?
>
> I think that I am close to having the invoker finished. My main concern is
> how are we going to get the beans instantiated so that I can
> test them as being deployed? My main concern with the invoker is, what parts
> of JAXRSInvoker correspond to sf.declareResourceClass?
> If that method will not run for EJB annotations, what will become of cri and
> ori? Will we change declareResourceClasses? Will it be
> necessary?
>
> I just wanted to update you on my progress. The class-scanner in the RP
> might be moved out of the RP into whatever class creates an
> EJB IDeployable and packages it into a bean, returing a factory instance.
>

Don't worry about the class scaner for now, please try to understand
how EasyBeans sets up a CXF JAX-WS endpoint and follow the same
process...

thanks, Sergey

> Thanks,
>
> Ryan
>



-- 
Sergey Beryozkin

http://sberyozkin.blogspot.com
Talend - http://www.talend.com

Mime
View raw message