Hi Rohan,
I think you still didn't get it
. At least your last explanation seems to me that way (forgive me when I am wrong
).
The destroy method is called by the container NOT BECAUSE THE GC DIDN'T DO ITS JOB OR BECAUSE TO KILL THE LAST SERVLET REMNANTS FROM MEMORY but because the container decides to do so in case of an container shut down for example.
Whether and when the finalize or GC works is under the control of your JVM.
The container just make his servlet objects (and all related objects) available (elligible) for GC without concern of whether your JVM start GC or not.
Regards,
Darya