Nilton,
According to the Peter Haggar´s book "Practival Java":
Praxis 67 : Do not rely on finalize methods for non-memory resource clean-up.
The finalize method of a class in invoked by JVM for an object of the class before the garbage collector reclaims its memory. This method is sometime advertised as a way to ensure non-memory resource are freed before the memory for an object is reclaimed. Because the garbage collector frees only object memory, the finalize method provides a way to free other resources.
Also in the Joshua Bloch´s Book "Effective Java":
Item 6: Avoid finalizers. ...
In summary, don´t use finalizers except as a safty net or to terminate noncritical native resources. In those rare instances where you do use finalizer, remember to invoke super.finalize...
Finalize is always called by the JVM and you can use it to release noncritical native resources, so I think you need to do a deep analisis of your code before define that a finalize call is unacceptable. My perception is that they read only the headers of some of these books.
Saludos,
Daniel.
Fecha: 21 de agosto de 2008 06:25:18 a.m. GMT-05:00
Asunto: Use of finalize methods in WO
Hi list,
We are running in discussions with some IT guys of one of our clients that are criticizing us for the use of WO.
Some of the arguments are pure rubish and not a problem at all. But one of the points they are stating is that, by the analysys of the garbage collector ,they are detecting the use of finalize() methods that, by ther judgement, is "bad practice", and harm the GC.
We don't call directly any finalize() in our methods.
Could anybody provide us with some opinion about this issue?
- where are the finalize() methods?(EOF, Wonder, ?) - how this use could affect GC perfomance? - is it a valid point "per se"?
Thanks in advance for help.
Bests regards,
****************************************************** Nilton Lessa Moleque de Idéias Educação e Tecnologia Ltda
******************************************************
|