users@glassfish.java.net

Re: why does stateful ejb throw exception for calling super.finalize();

From: emiddio-frontier <emiddio_at_frontier.com>
Date: Fri, 25 Feb 2011 12:21:55 -0800

I wanted to track the creation and deletion of EJB instances -- motivated by seeing so many instances created for a simple JSF2 web page -- when i thought only 1 would have been needed;

each web page click invokes the bean's constructor 3 times for a page with 3 input fields; -- i added a no-arg constructor to the bean to track instantiations in the beans class with static volaitile int fields.

and i thought that since finalize is in every class -- inherited from Object that it would not be possible to get an exception overriding finalize.

Now i trying to understand WHY this does not work -- planning to step thru gfv301 source code for some insights;

I did see the specs do say to not override/implement finalize --but they do not say why.

I am learning and at this point guessing is has something to do with Proxy

thanks

gary

  ----- Original Message -----
  From: Steven Siebert
  To: marina.vatkina_at_oracle.com
  Cc: emiddio-frontier ; users_at_glassfish.java.net
  Sent: Friday, February 25, 2011 4:51 AM
  Subject: Re: why does stateful ejb throw exception for calling super.finalize();


  Gary,


  What are you trying to accomplish? It's likely you can accomplish what you are looking for by using the session beans lifecycle callbacks.


  S


  On Thu, Feb 24, 2011 at 10:47 PM, Marina Vatkina <marina.vatkina_at_oracle.com> wrote:

    No, it's not ok to have finalaize method in the bean class.

    -marina

    emiddio-frontier wrote:

      So does this mean its okay to have finalaize method but dont call
      super.finalize(); ???

      I will try to find the spec section you mention.

      thanks

      gary