To make it really thread-safe:
keyOf() and getAllRegisteredKeys() should be made synchronized;
getAllRegisteredKeys() should return a defensive copy: new TreeMap<>(REGISTERED_KEYS).values()
Relevant concurrency checklist items: https://github.com/code-review-checklists/java-concurrency#unsafe-concurrent-point-read, https://github.com/code-review-checklists/java-concurrency#unsafe-concurrent-iteration
To make it really thread-safe:
keyOf()andgetAllRegisteredKeys()should be made synchronized;getAllRegisteredKeys()should return a defensive copy:new TreeMap<>(REGISTERED_KEYS).values()Relevant concurrency checklist items: https://github.com/code-review-checklists/java-concurrency#unsafe-concurrent-point-read, https://github.com/code-review-checklists/java-concurrency#unsafe-concurrent-iteration