Originally posted by AparnaYadav Yadav:
Hi,
Can anyone plz tell me why we can't define finalize() method in EJB & we have to define a public constructor in case of MDB.
Thanks in advance.
Aparna.
Finalize method is discouraged because it may be never be called.
In MDB, it is container which handles the life cycle of MDB and it is also responsible for pooling the instances. Public no-arg constructor is required so that the container create instances and pool them.