A metaspace arena (called SpaceManager before JEP387) has a reference to an outside-provided lock which resides in the owning CLD (_metaspace_lock). It locks itself using this lock.
This seems an unusual pattern and causes code to be more complicated than needed. E.g. it causes the existence of the MetaspaceTestArena class whose only purpose is to bundle a lock with an arena.
Investigate whether it would be better to either
- let the arena be oblivious to any locking and make it the responsibility of the caller to lock
- let the arena own its own lock.
Both solutions are viable, but should be investigated only after the brunt of the JEP387 changes hits mainline.