anmolnar commented on code in PR #8044:
URL: https://github.com/apache/hbase/pull/8044#discussion_r3076388440


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java:
##########
@@ -130,6 +132,39 @@ public Set<String> getCoprocessorClassNames() {
     return returnValue;
   }
 
+  /**
+   * Used to help make the relevant loaded coprocessors dynamically 
configurable by registering them
+   * to the {@link ConfigurationManager}. Coprocessors are considered 
"relevant" if they implement
+   * the {@link ConfigurationObserver} interface.
+   * @param configurationManager the ConfigurationManager the coprocessors get 
registered to
+   */
+  public void registerConfigurationObservers(ConfigurationManager 
configurationManager) {
+    Coprocessor foundCp;
+    Set<String> coprocessors = this.getCoprocessors();
+    for (String cp : coprocessors) {
+      foundCp = this.findCoprocessor(cp);
+      if (foundCp instanceof ConfigurationObserver) {
+        configurationManager.registerObserver((ConfigurationObserver) foundCp);
+      }
+    }
+  }
+
+  /**
+   * Deregisters relevant coprocessors from the {@link ConfigurationManager}. 
Coprocessors are
+   * considered "relevant" if they implement the {@link ConfigurationObserver} 
interface.
+   * @param configurationManager the ConfigurationManager the coprocessors get 
deregistered from
+   */
+  public void deregisterConfigurationObservers(ConfigurationManager 
configurationManager) {
+    Coprocessor foundCp;
+    Set<String> coprocessors = this.getCoprocessors();
+    for (String cp : coprocessors) {
+      foundCp = this.findCoprocessor(cp);
+      if (foundCp instanceof ConfigurationObserver) {
+        configurationManager.deregisterObserver((ConfigurationObserver) 
foundCp);
+      }
+    }

Review Comment:
   The above mentioned callers (HMaster, HRegion, etc.) are the configuration 
observers. Since the coprocessors don't have to track the read-only mode flag - 
they're either loaded or not loaded - they don't have to observe the 
configuration change.



-- 
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]

Reply via email to