2017-01-20 13:14 GMT+01:00 Mark Thomas <ma...@apache.org>: > Rory, > > We have a handful of instances where Tomcat currently needs to use > reflection which are blocked when running on Java 9. > > Users can work-around these but it would probably be better if an > alternative API was identified / provided to achieve the same results > without reflection. > > There are currently three instances I am aware of. > > 1. Cleaning direct ByteBuffers > To avoid OOME, we need to be able to trigger cleaning of a direct > ByteBuffers. The code in question is at [1]. We need a way to trigger > DirectByteBuffer.cleaner().clean() via a public API. >
Technically this is: https://bugs.openjdk.java.net/browse/JDK-8171377 Essentially, we must now use sun.misc.Unsafe.getUnsafe.invokeCleaner(byteBuffer). The problem is that we cannot use reflection (Unsafe.getUnsafe is explicitly filtered out) and there's also a security check which may or may not necessitate some extra configuration. > > 2. Cleaning thread local related memory leaks > To fix application created memory leaks, we need to be able to clear > thread locals associated with a given class loader from a thread. > To be able to warn users they have a memory leak in their application, > we need to be able to list the thread locals associated with a class > loader for a thread. The relevant code is at [2]. > > 3. Cleaning RMI related memory leaks > To fix application created memory leaks, we need to be able to clear RMI > objects associated with a given class loader. > To be able to warn users they have a memory leak in their application, > we need to be able to list the RMI targets associated with a given > classloader. The relevant code is at [3]. > > Any suggestions for alternative public APIs to achieve the same ends > gratefully received. > +1 Rémy > > Kind regards, > > Mark > > > [1] > http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/ > ByteBufferUtils.java?diff_format=h&view=annotate#l38 > > [2] > http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/ > WebappClassLoaderBase.java?diff_format=h&view=annotate#l1823 > > [3] > http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/ > WebappClassLoaderBase.java?diff_format=h&view=annotate#l2058 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >