Promptly freeing the per-thread cached direct buffers when a thread exits

Martin Buchholz martinrb at google.com
Sun Apr 8 19:35:31 UTC 2018


On Fri, Apr 6, 2018 at 1:02 AM, Alan Bateman <Alan.Bateman at oracle.com>
wrote:

> On 05/04/2018 22:45, Tony Printezis wrote:
>
>>
>> We recently hit another interesting issue with the NIO thread-local
>> DirectByteBuffer cache. One of our services seems to create and drop
>> threads at regular intervals. I assume this is due to a thread pool
>> dynamically resizing itself.
>>
>
ThreadPoolExecutor will replace any worker thread that had a throwing task,
but that only happens on execute, (not submit, because of additional
wrapping by a Future).  Perhaps a mistake that is too late to fix.  Keep
your own worker threads from dying by making sure that all tasks are
Future-wrapped.


More information about the core-libs-dev mailing list