I am looking for a class similar to ThreadLocal which would work on thread groups instead of threads.
If there is not such a class (in some open source library) how
The last time i looked at the implementation (well a few years ago) Thread Locals were implemented as a simple hash table indexed by the thread id. Nothing fancy and miles away from the efficiency of C++.
You can do the same and use the thread group object as a key for your own thread group locals hash table.