beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kyle Marvin <>
Subject Re: Lifecycle Questions
Date Mon, 29 Nov 2004 23:27:35 GMT
On Mon, 29 Nov 2004 17:13:02 -0500, Dan Diephouse
<> wrote:

> Thanks, that part makes a lot more sense now.  However, I have been
> playing with nested controls.  In this example I have a control called
> BlogTool which is used in my controller.  I have also have the
> HibernateControl which is used in my BlogTool.  The BlogTool control
> provides a pretty wrapper for hibernate queries, etc.
> @ControlImplementation
> public class BlogToolImpl
>     implements BlogTool
> {
>     @Control HibernateControl control;
>     @Context ResourceContext resourceContext;
>     ....
> }
> My BlogTool is receives onAcquire/onRelease events for every http
> request.  But, the HibernateControl doesn't receive these events for
> ever http request.  The HibernateControl's resource lifecycle seems to
> be the duration of the Controller (ie, an HttpSession).  Whats the
> reasoning for that?  I would think that the child control would have the
> same lifecycle as its parent. Is there anyway to get the events that the
> parent receives as well?

A control will only receive an onAcquire event if it is actually used
within a given resource scope... so if there is a scenario where the
BlogControl was called, but it didn't make any invocations on the
nested HibernateControl, then it (Blog) would get an onAcquire event
when the nested (Hibernate) control did not.

Otherwise, I'm surprised by what you are describing... if you get into
a method (or Extensible.invoke) on the Hibernate control but haven't
seen an onAcquire event for it, that's definitely a bug.

View raw message