vyommani commented on code in PR #531:
URL: https://github.com/apache/ranger/pull/531#discussion_r1954185562
##########
agents-common/src/main/java/org/apache/ranger/plugin/contextenricher/RangerAbstractContextEnricher.java:
##########
@@ -300,13 +300,4 @@ public Properties readProperties(String fileName) {
return ret;
}
-
Review Comment:
Removing the finalize() method without an alternative cleanup method is not
advisable. However, my analysis reveals that we already have robust cleanup
mechanisms in place.
Upon reviewing the Ranger source code, I found that the PolicyEngine is
referenced in the following classes:
RangerPolicyAdminImpl
RangerPolicyEngineImpl
Both RangerPolicyAdminImpl and RangerPolicyEngineImpl have a
releaseResources(boolean isForced) method, which calls the preCleanup(isForced)
method on the PolicyEngine. This preCleanup method performs the following
cleanup operations:
Calls policyRepository.preCleanup()
Calls tagPolicyRepository.preCleanup()
Calls zonePolicyRepositories.preCleanup()
These preCleanup methods on the repository iterate through the Context
Enrichers and call preCleanup on individual instances.
Upon further review, I noticed that the setPolicies method in
RangerBasePlugin calls the releaseResources method on RangerPolicyEngineImpl.
This ensures that resources held by the old policy engine are properly released
before updating to the new policy.
Given that we already have alternative cleanup method (releaseResources), I
believe we can safely remove the finalize() method. Please review my findings
and let me know if I've missed any code paths.
--
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]