Hi,
some of you might already be aware that the finalize mechanism in the
JVM is basically flawed and there could be issues even when it's used
for commonly accepted reasons (like cleaning up stuff that the user
forgot about). A very interesting presentation has been recently made
available on this topic, I suggest having a look at
https://www.youtube.com/watch?v=UrGP6pfb0H8 .
This said, it's many months (possibly years) since I started seeing
infrequent transient failures in the JBossWS <-> Apache CXF integration
testsuite, usually caused by "Socket closed" java.net.SocketException
exceptions (here is an example,
http://www.fpaste.org/139814/41267248/raw/). To be honest, I have no
proof this is actually related to the finalize() topic above, but I'm
wondering if anybody here ever seriously considered the potential issue.
We do have a finalize() method in the ClientProxy, which calls the
close() method which in turn calls ClientImpl's destroy() method. That
goes through multiple cleanup things, including shutting down the
Conduit, which is always based on URLConnection in my case. To give an
idea of the kind of issues, before you have a look at the presentation,
especially on highly optimized JDK, the finalize method might end up
being called when the resources it's meant to cleanup are still being used.
Any thoughts?
Cheers
Alessio
--
Alessio Soldano
Web Service Lead, JBoss