pkuwm commented on a change in pull request #557: Add instance capacity gauge

 File path: 
 @@ -159,28 +163,30 @@ public synchronized void unregister() {
   public Object getAttribute(String attribute)
-      throws AttributeNotFoundException, MBeanException, ReflectionException {
+      throws AttributeNotFoundException {
     if (SENSOR_NAME_TAG.equals(attribute)) {
       return getSensorName();
-    if (!_attributeMap.containsKey(attribute)) {
-      return null;
+    DynamicMetric metric = _attributeMap.get(attribute);
+    if (metric == null) {
+      throw new AttributeNotFoundException("Attribute[" + attribute + "] is 
not found.");
 Review comment:
   Test results:
   1. MBeanInfo async with the list.
   Running 2 threads: thread 1 awaits while it is updating attributes "A" and 
"B" (not completed); meanwhile, thread 2 updates attributes "C", "D" and 
completes. Finally, "C", "D" could be fetched correctly, while getting "A" and 
"B" throws AttributeNotFoundException. thread 1 completes updating. Fetching 
"A", "B" correctly, and throwing AttributeNotFoundException for fetching "C", 
   2. Fix async.
   Has run a few tests. It works fine and confirms to fetch the data correctly.

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.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to