Is it possible to clear the ThreadLocal variables if a thread is handed back to pool after use in EAP?

Solution Verified - Updated -

Issue

  • If ThreadLocal variables are used to store application information across several (internal) invocations these can be left which might consume memory and also affects the next task which is handled by this Thread. Is there a way to clear it if handed back to pool, i.e. by a listerner for the ThreadPool?
  • ThreadLocals were not cleared when a thread was returned to the pool. Is there an option in EAP to clear them?
  • Is it possible to register a listener or somewhat to do customize the cleanup for a thread if handed back to pool?

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content