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


##########
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:
   This was introduced in PR https://github.com/apache/hbase/pull/6931 when we 
first added support for dynamic configuration with the ReadOnlyController.  At 
that time, we had only one ReadOnlyController class, and it implemented 
ConfigurationObserver.  We needed to be able to have dynamic configuration at 
the coprocessor level.  It looks like this code is not needed anymore, so I am 
working on removing it and making sure everything still works as expected.



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