Context
After #6715, disposeUnit() decrements the adapter refcount for each DataStore. If disposeUnit() is called twice on the same unit, the second call finds no entry in adapterRefCounts (already removed on first call) and silently no-ops.
Problem
Silent no-op on double-dispose hides lifecycle bugs in callers. A unit disposed twice indicates an error in the caller's lifecycle management, but the engine gives no feedback.
Options
- Throw
IllegalStateException on double-dispose (strict — forces callers to be correct)
- Log a warning (lenient — surfaces the bug without crashing)
- Track disposed units in a Set and assert (clearer diagnostics)
Option 1 is preferred — vol2 has no external users, breaking callers is the point.
Refs #6715
Context
After #6715,
disposeUnit()decrements the adapter refcount for each DataStore. IfdisposeUnit()is called twice on the same unit, the second call finds no entry inadapterRefCounts(already removed on first call) and silently no-ops.Problem
Silent no-op on double-dispose hides lifecycle bugs in callers. A unit disposed twice indicates an error in the caller's lifecycle management, but the engine gives no feedback.
Options
IllegalStateExceptionon double-dispose (strict — forces callers to be correct)Option 1 is preferred — vol2 has no external users, breaking callers is the point.
Refs #6715