users
[Top] [All Lists]

tag handler reuse question

To: <users@xxxxxxxxxx>
Subject: tag handler reuse question
From: "Mitchell, John" <jlmitchell@xxxxxxxx>
Date: Tue, 27 Mar 2007 12:33:49 -0400
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thread-index: AcdwjbKB2ebnKQO8RAKMKfdqZmHG1A==
Thread-topic: tag handler reuse question

I just noticed some code in a doEndTag() which raised my eyebrows.

In J2EE, I understand that the container (implementation of the spec) can pool session beans, and that this is configurable.  ...likewise with connection pools.

Everything else I had thought was either...(1) a static class (rather, static methods in a class) which would have application scope (more than one session can affect the same attributes, raising some coding considerations), or...(2) an instance of a class, having - at the most - session scope via a reference put in the session (unless explicitly given a reference in the application scope).

The following code implies that the container (weblogic, in my case) might decide to keep a tag handler instance for reuse by other sessions, or at least by my session once again (not sure if the former).

If the former, that would seem to put the responsibility on the developer to 'clean up' or null-out attributes before being done, and even synchronize the scope from doStartTag() through doEndTag().  If the later, puts the same responsibility on the developer (apparently), but of course there is no concurrence concern.

Any input on this?  I had never heard of this before.  (...assuming the logic was placed there by someone correctly understanding the container capability/discretion to reuse an instance...)

Thanks,

John Mitchell

  public int doEndTag() throws JspException {
    //reinit properties in case tag instance reused by container
    crudOperation = null;
    crudOperationBean = null;
        [ ...etc. ]

users@xxxxxxxxxx


**********************************************************************
The content of this e-mail message and any attachments are confidential and may be legally privileged, intended solely for the addressee.
If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited.
If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments.
**********************************************************************
<Prev in Thread] Current Thread [Next in Thread>