I agree with David. Leave it to the container and JVM.
-Jack
On Wed, Mar 24, 2010 at 12:35 AM, Russell Collins <
russell.coll...@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
> “m_anotherEJB” and I do not need to be concerned about this object hanging
> around more than it needs to?
>
>
>
> *From:* David Jencks [mailto:david_jen...@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 the
> 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’s inside the EJB
> container. I am wondering if I should be setting used EJB’s to null when I
> am done with them or should I just let the container handle it. Example
> Code:
>
>
>
>
>
>
>
> @Stateless
>
> public class MyEJB implements IMyEJB
>
> {
>
>
>
>@EJB(name=”AnotherEJBLocal”)
>
>private IAnotherEJBLocal m_anotherEJB;
>
>
>
> // Do some stuff with m_anotherEJB;
>
>
>
>protected void finalize()
>
>{
>
> m_anotherEJB = 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 handle
> 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 ADVANCED
> 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 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 error by email reply immediately.
>
>
>
> --
> CONFIDENTIALITY NOTICE: The information contained in this electronic mail
> (email) transmission (including attachments), is intended by MCLANE ADVANCED
> 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 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 error by email reply immediately.
>