Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 93885 invoked from network); 24 Mar 2010 07:20:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 24 Mar 2010 07:20:16 -0000 Received: (qmail 68702 invoked by uid 500); 24 Mar 2010 07:20:16 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 68370 invoked by uid 500); 24 Mar 2010 07:20:14 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 68358 invoked by uid 99); 24 Mar 2010 07:20:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Mar 2010 07:20:13 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=AWL,FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of greensight@gmail.com designates 209.85.216.204 as permitted sender) Received: from [209.85.216.204] (HELO mail-px0-f204.google.com) (209.85.216.204) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Mar 2010 07:20:07 +0000 Received: by pxi42 with SMTP id 42so1961829pxi.24 for ; Wed, 24 Mar 2010 00:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=tJhQ3yTml0cjD/byWs0kDWBoY4+jykVLPGl0O1APaEA=; b=SPNA6lgQgS4QzAnJ+Y/Hl4phnwY0MzfZKl3A33usW8XuNYvDWeblrQc1fGiQxNdTjD K0hoyZt+KeTGYoo6TXTFoFErTgMPHhOCXyR+MaCKcM8udgiERsNAHMItW0Gn5hAWHOKH S5E5muFCeNobQWfNl9kb/+cBf3AtsuCmRZExs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=PA3gmSrS919eDycmL9aYOI/962MXcYm8QsvJl4vKnqZQxtDS/mustTZqLRLm+jDWrQ MkRiMugc5AzFgP6e+rK1ox6SkD7IRrWdsEsOzn70qLOk5vPO6rKz4LSRihNEf80S5Ff4 +oGoqnWNF4R/hVSxWiJOl4EiW7oWiOGJnhtdg= MIME-Version: 1.0 Received: by 10.114.249.6 with SMTP id w6mr2783391wah.75.1269415186985; Wed, 24 Mar 2010 00:19:46 -0700 (PDT) In-Reply-To: <69BEFCE5AAEBCA44B1301AD2360E83C7A8B9C4368C@MATSVEC14.mclane.local> References: <69BEFCE5AAEBCA44B1301AD2360E83C7A8B9A964E5@MATSVEC14.mclane.local> <69BEFCE5AAEBCA44B1301AD2360E83C7A8B9C43519@MATSVEC14.mclane.local> <69BEFCE5AAEBCA44B1301AD2360E83C7A8B9C4368C@MATSVEC14.mclane.local> Date: Wed, 24 Mar 2010 15:19:46 +0800 Message-ID: <5e7fd1eb1003240019h71cc81ia92ca273bf38fa08@mail.gmail.com> Subject: Re: EJB Life Cycle From: Jack Cai To: user@geronimo.apache.org Content-Type: multipart/alternative; boundary=0016e64dbe124af55c048286c12c --0016e64dbe124af55c048286c12c Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I agree with David. Leave it to the container and JVM. -Jack On Wed, Mar 24, 2010 at 12:35 AM, Russell Collins < Russell.Collins@mclaneat.com> wrote: > Thank you for the input. So basically what you are saying is that the > Geronimo EJB container will handle the lifecycle of the object > =93m_anotherEJB=94 and I do not need to be concerned about this object ha= nging > around more than it needs to? > > > > *From:* David Jencks [mailto:david_jencks@yahoo.com] > *Sent:* Tuesday, March 23, 2010 2:38 AM > *To:* user@geronimo.apache.org > *Subject:* Re: EJB Life Cycle > > > > I'm not a big java GC expert but... I think that finalize will only be > called after the GC has decided your ejb instance is no longer in use. > Whether or not the proxy it's holding is still in use will be determined > separately anyway. My understanding is that generally "I want to help t= he > GC" code doesn't actually help appreciably and mostly gives you more code= to > install bugs in and maintain. > > > > david jencks > > > > On Mar 22, 2010, at 7:03 PM, Russell Collins wrote: > > > > I have been thinking about best practices with Geronimo. One of the > things that I have been thinking about is the life of EJB=92s inside the = EJB > container. I am wondering if I should be setting used EJB=92s to null wh= en I > am done with them or should I just let the container handle it. Example > Code: > > > > > > > > @Stateless > > public class MyEJB implements IMyEJB > > { > > > > @EJB(name=3D=94AnotherEJBLocal=94) > > private IAnotherEJBLocal m_anotherEJB; > > > > // Do some stuff with m_anotherEJB; > > > > protected void finalize() > > { > > m_anotherEJB =3D null; // Should I do this or let Geronimo handle = it > > } > > > > } > > > > Should I be including the finalizer code as I have it? Should I just let > Geronimo handle the life cycle? Is there a different/better way to handl= e > this? Any philosophical insight would be greatly appreciated. Thanks. > > > > > > *Russell Collins* > > Sr. Software Engineer > > McLane Advanced Technology > > > > > ------------------------------ > > CONFIDENTIALITY NOTICE: The information contained in this electronic mail > (email) transmission (including attachments), is intended by MCLANE ADVAN= CED > TECHNOLOGIES for the use of the named individual or entity to which it is > addressed and may contain information that is privileged, confidential > and/or protected as a trade secret. It is not intended for transmission t= o, > or receipt by, any individual or entity other than the named addressee(s)= . > If you have received this email in error, please delete it (including > attachments) and any copies thereof without printing, copying or forwardi= ng > it, and notify the sender of the error by email reply immediately. > > > > ------------------------------ > CONFIDENTIALITY NOTICE: The information contained in this electronic mail > (email) transmission (including attachments), is intended by MCLANE ADVAN= CED > TECHNOLOGIES for the use of the named individual or entity to which it is > addressed and may contain information that is privileged, confidential > and/or protected as a trade secret. It is not intended for transmission t= o, > or receipt by, any individual or entity other than the named addressee(s)= . > If you have received this email in error, please delete it (including > attachments) and any copies thereof without printing, copying or forwardi= ng > it, and notify the sender of the error by email reply immediately. > --0016e64dbe124af55c048286c12c Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I agree with David. Leave it to the container and JVM.

-Jack

=
On Wed, Mar 24, 2010 at 12:35 AM, Russell Collin= s <Rus= sell.Collins@mclaneat.com> wrote:

Thank you for the input.=A0 So basically what you are saying is that the= Geronimo EJB container will handle the lifecycle of the object =93m_anothe= rEJB=94 and I do not need to be concerned about this object hanging around more than it = needs to?

=A0

From:= David Jencks [mailto:david_jencks@yahoo.com]
Sent: Tuesday, March 23, 2010 2:38 AM
To: us= er@geronimo.apache.org
Subject: Re: EJB Life Cycle

=A0

I'm not a big java GC expert but... =A0I think t= hat finalize will only be called after the GC has decided your ejb instance= is no longer in use. =A0Whether or not the proxy it's holding is still= in use will be determined separately anyway. =A0My understanding is that generally =A0"I want to help the GC"= code doesn't actually help appreciably and mostly gives you more code = to install bugs in and maintain.

=A0

david jencks

=A0

On Mar 22, 2010, at 7:03 PM, Russell Collins wrote:<= /p>



I have= been thinking about best practices with Geronimo.=A0 One of the things tha= t I have been thinking about is the life of EJB=92s inside the EJB containe= r.=A0 I am wondering if I should be setting used EJB=92s to null when I am done wi= th them or should I just let the container handle it.=A0 Example Code:

=A0

=A0

=A0

@State= less

public= class MyEJB implements IMyEJB

{

=A0

=A0=A0= @EJB(name=3D=94AnotherEJBLocal=94)

=A0=A0= private IAnotherEJBLocal m_anotherEJB;

=A0

=A0 //= Do some stuff with m_anotherEJB;

=A0

=A0=A0= protected void finalize()

=A0=A0= {

=A0=A0= =A0=A0 m_anotherEJB =3D null;=A0 //=A0 Should I do this or let Geronimo han= dle it

=A0=A0= =A0 }

=A0

}

=A0

Should= I be including the finalizer code as I have it?=A0 Should I just let Geron= imo handle the life cycle?=A0 Is there a different/better way to handle thi= s?=A0 Any philosophical insight would be greatly appreciated.=A0 Thanks.

=A0

=A0

Russell Collins

Sr. Software Engineer

McLane Advanced Technology

=A0

=A0=


CONFI= DENTIALITY NOTICE: The information contained in this electronic mail (email= ) transmission (including attachments), is intended by MCLANE ADVANCED TECH= NOLOGIES for the use of the named individual or entity to which it is addressed and= may contain information that is privileged, confidential and/or protected = as a trade secret. It is not intended for transmission to, or receipt by, a= ny individual or entity other than the named addressee(s). If you have received this email in error, please d= elete it (including attachments) and any copies thereof without printing, c= opying or forwarding it, and notify the sender of the error by email reply = immediately.=

=A0



CONFIDENTIALITY NOTICE: The= information contained in this electronic mail (email) transmission (includ= ing attachments), is intended by MCLANE ADVANCED TECHNOLOGIES for the use o= f the named individual or entity to which it is addressed and may contain information that is privileged, confidenti= al and/or protected as a trade secret. It is not intended for transmission = to, or receipt by, any individual or entity other than the named addressee(= s). If you have received this email in error, please delete it (including attachments) and any copies thereof = without printing, copying or forwarding it, and notify the sender of the er= ror by email reply immediately.

--0016e64dbe124af55c048286c12c--