1 Reply Latest reply on Nov 23, 2009 6:52 PM by Walter White

    destroy() vs. finalize()

    Gregory Nikle Apprentice

      Can anybody explain me, where is difference between destroy() and finalize() methods in SFSB and in simple POJO?

      Do I need to create finalize() method to cleanup objects in beans?

        • 1. Re: destroy() vs. finalize()
          Walter White Novice

          I think destroy is a different lifecycle event where the bean is destroyed by the container explicitly at the end of a context.  It however, may still live in the heap where finalize would then be called by the JVM at garbage collection.

          It depends on what you do, I use destroy more often than finalize.  It would be the same pattern as using finally in your try-catch blocks.