You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by be...@incubator.apache.org on 2004/10/05 23:31:32 UTC

[jira] Closed: (BEEHIVE-4) ControlBeanContext.LifeCycle does not have OnFinish() callback

Message:

   The following issue has been closed.

   Resolver: Kenneth Tam
       Date: Tue, 5 Oct 2004 2:29 PM

Providing an 'onFinish' event is problematic, for several different reasons:

- A control is just a JavaBean, that can have one or more references to it.  The full lifecycle of the bean (like any other Java object) is determined by the lifetime of one or more references to the object.   The only time you know you are 'finished' with the control is when all references are released;  however, relying upon a final notification when the last reference is released has all the same issues that relying upon java.lang.Object.finalize() has.

- The number of controls that may be in-memory at any point in time is not constrained or managed... but generally speaking you do want to manage the number of active connections to an EIS resource.  The common approach is to use pooling and to have clients only obtain/release connections for short periods of time.  The pool mgr will generally hold and recycle connections if they are expensive to obtain or release.   The Controls runtime does not (and should not) provide the mechanisms for resource pooling;  it's intent is to provide a facade pattern for resource access, not a system-level mechanism for resource management.

- The ResourceManager onAcquire/onRelease LifeCycle events are provided for precisely the purpose described in this bug scenario.  A control will get an onAcquire event when any of its methods are invoked (excluding property accessors) and will receive the onRelease event at an appropriate endpoint defined by the container in which the control is executing (end of current request, transaction, ...).   A control should *never* hold onto external resources (connections/sessions in pools, etc) outside the scope of these ResourceManager events.

Just to be complete, the onCreate event exists for a very specific purpose.  It enables a Control author to write code that would normally be placed in a constructor, but in the context of a control implementation guarantees that the control is fully initialized (ex. nested controls or contextual services are init'ed); whereas code running in the impl class constructor would precede this initialization.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/BEEHIVE-4

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: BEEHIVE-4
    Summary: ControlBeanContext.LifeCycle does not have OnFinish() callback
       Type: Improvement

     Status: Closed
   Priority: Major
 Resolution: FIXED

    Project: Beehive
 Components: 
             Controls
   Fix Fors:
             TBD

   Assignee: Kyle Marvin
   Reporter: suryanarayanan nagarajan

    Created: Sun, 12 Sep 2004 11:09 PM
    Updated: Tue, 5 Oct 2004 2:29 PM

Description:

ControlBeanContext.LifeCycle has only OnCreate() method. OnFinish() callback is important to release all resources used to connect to EIS.
  A typical use case would be one where connections to EIS need to be persisted across resource scopes but connection objects cannot be serialized. Connections would be acquired in OnCreate() through a factory and the same connectio would be got in every OnAcquire() call. These connections can be released only when the ControlBeanContext goes out of scope.




---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira