Return-Path: Delivered-To: apmail-incubator-beehive-user-archive@www.apache.org Received: (qmail 32165 invoked from network); 29 Nov 2004 21:10:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Nov 2004 21:10:40 -0000 Received: (qmail 1369 invoked by uid 500); 29 Nov 2004 21:10:38 -0000 Delivered-To: apmail-incubator-beehive-user-archive@incubator.apache.org Received: (qmail 1348 invoked by uid 500); 29 Nov 2004 21:10:38 -0000 Mailing-List: contact beehive-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Users" Delivered-To: mailing list beehive-user@incubator.apache.org Received: (qmail 1332 invoked by uid 99); 29 Nov 2004 21:10:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of kylemarvin@gmail.com designates 64.233.170.194 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.194) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 29 Nov 2004 13:10:37 -0800 Received: by rproxy.gmail.com with SMTP id i8so460970rne for ; Mon, 29 Nov 2004 13:10:35 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=HCpM+9tC7Zb2tG5afU4PWJg+fhLbZJJ1ut6PqLiKz/CNCJ9+YEi3eYgCk3xzpAHx8834xpPpnHp7gVMJDpHWVd1YzwmorCiCR5SAbBj2/tTf4tsATqYVBAwhih7z62QvO7JjObKd9UJO/6rluh1bWDc6Kwk36LJRsysqvRk0dbs= Received: by 10.38.150.8 with SMTP id x8mr115631rnd; Mon, 29 Nov 2004 13:10:35 -0800 (PST) Received: by 10.38.77.51 with HTTP; Mon, 29 Nov 2004 13:10:35 -0800 (PST) Message-ID: <3e7c9d1504112913101e7b4bb3@mail.gmail.com> Date: Mon, 29 Nov 2004 15:10:35 -0600 From: Kyle Marvin Reply-To: Kyle Marvin To: Beehive Users Subject: Re: Lifecycle Questions In-Reply-To: <41AB5185.5070100@envoisolutions.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41AB5185.5070100@envoisolutions.com> X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N The resource scope of a controller is similar to the scope of the JSP page. It enables control resources to be held for the duration of the processing of an action, not for the lifetime of an entire flow (which may span multiple requests). State another, resource acquisition *never* spans across multiple (http) requests for either jsp pages or pageflows, so should be appropriate (I think) for Hibernate sessions in either context. The onAcquire event is delivered once (and only once) before any operation is invoked on a control within any given resource scope. The onRelease event is delivered once (and only once) at the end of the associated resource scope. With regards to onCreate it is called the first time a control bean is invoked upon after creation. This is because a ControlImplementation instance associated with a bean are lazily instantiated on first use of the bean. When a bean get created somewhat depends upon the usage. In the JSP page case, if the bean is page or request scoped (ex. ), you are going to get a new bean instantiated for each page/request, so you'll see onCreate called each time. If the bean is session or applicationo scoped (ex. ), the bean generally gets instantiated once per session, onCreate is called once, and then the bean is serialized into session state. For pageflows, I think the answer is that the control lifecycle is generally tied to the flow lifecycle. All the control instances contained within a pageflow will be instantiated when the flow is initialized (and get their onCreate events). On Mon, 29 Nov 2004 11:42:45 -0500, Dan Diephouse wrote: > I am trying to understand the Context Lifecycle events and how I can use > them. Using the onAcquire/onRelease/onCreate methods seems simple > enough but I am confused as to when they are actually called. So I was > wondering if someone could help me fill in the blanks here for the > different cases: > > Within a JSP Page: > onAcquire - called at the beginning of the scope (page, request, etc) > onRelease - called at the end of the scope (page, request, etc) > onCreate - called when the control is initialized at the beginning of a > a new scope??? > > Within a Controller: > onAcquire - called once when first used?? > onRelease - called when the application exits?? > onCreate - called once when first initialized?? > > Within another Control: > onAcquire/onRelease/onCreate: called whenever the parent control's > lifecycle methods are called > > I'm trying to figure out where I can put a control so it receives the > lifecycle events for the page request to manage hibernate > sessions/transactions, and from the above it looks like within the JSP > page itself is my only choice. > > Thanks, > - Dan > > -- > Dan Diephouse > Envoi Solutions LLC > http://envoisolutions.com/people/dan > >