Fix deadlock by wrong locking order:
- Also add JavaDoc so it doesn't happen again