I think maven core uses variation of 2), where classloaders that implement Closeable get closed [1]. I recommend doing the same in the core plugins too. Anything more elaborate seems like a waste of effort given the core will still leak file handles on java 6 and earlier and the number of users on these earlier jvm is bound to go down.
[1] https://github.com/sonatype/plexus-classworlds/blob/master/src/main/java/org/codehaus/plexus/classworlds/ClassWorld.java#L105
-- Regards, Igor On 1/30/2014, 3:38, James Nord (jnord) wrote:
Hi All, 1. I have discovered a few file handle leaks in core plugins - which leads to random build failures with large multi-module projects. Before I go and make & submit some changes I wanted to ask what's likely to be accepted (in the case where this is classloader related[1]). 1) Use JDK7 only and call URLClassLoader.close() 2) Use reflection to do the same (would only fix the issue when run on JDK7+) 3) Use reflection to access Oracle private methods in JDK<7 and generic in JDK7+ (would not work when run on non oracle JVMs <7) 4) Write a custom Classloader (may not get all the securityManager aspects correct) 5) Use someone elses ClassLoader (e.g eclipse - what licences are available to use for deps in core plugins?) /James [1] http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4950148
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
