nevzheng opened a new issue, #12201: URL: https://github.com/apache/gravitino/issues/12201
### What would you like to be improved? `TableHookDispatcher` decorates table operations with ownership and authorization lifecycle behavior. Although its underlying `TableDispatcher` is supplied through its constructor, it still obtains `OwnerDispatcher` and `CatalogManager` at runtime through `GravitinoEnv.getInstance()`. This makes those dependencies implicit and couples unit tests to shared singleton state. Tests must modify private `GravitinoEnv` fields through reflection and restore them afterward. This is an internal code-quality and test-isolation improvement; there is no known user-facing behavior defect. `GravitinoEnv` should remain the composition root, while `TableHookDispatcher` receives its collaborators explicitly. ### How should we improve? Update the `TableHookDispatcher` constructor to receive: - `Supplier<OwnerDispatcher>` for lazy resolution, because the owner dispatcher is constructed later and may be `null` when authorization is disabled. - `CatalogManager` for catalog capability handling. Wire these dependencies from `GravitinoEnv`, propagate the constructor change to every construction site, and update the affected tests to instantiate `TableHookDispatcher` directly with mocks. The change should preserve behavior and should not introduce a dependency-injection framework. Deleting `GravitinoEnv` or its `getInstance()` accessor is out of scope. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
