You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2020/07/15 19:58:13 UTC

[helix] branch release-1.0.1 updated (1054786 -> bd3b854)

This is an automated email from the ASF dual-hosted git repository.

jxue pushed a change to branch release-1.0.1
in repository https://gitbox.apache.org/repos/asf/helix.git.


    from 1054786  Change version to 1.0.0
     new 3e4069a  Revert "[maven-release-plugin] prepare for next development iteration"
     new 5d422ea  Revert "[maven-release-plugin] prepare release helix-1.0.1"
     new bd3b854  Remove legacy duplicate metric classes in helix-core (#1147)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 helix-admin-webapp/pom.xml                         |   2 +-
 helix-agent/pom.xml                                |   2 +-
 helix-common/pom.xml                               |   2 +-
 helix-core/pom.xml                                 |   2 +-
 .../mbeans/dynamicMBeans/DynamicMBeanProvider.java | 237 ---------------------
 .../mbeans/dynamicMBeans/SimpleDynamicMetric.java  |  60 ------
 helix-front/pom.xml                                |   2 +-
 helix-lock/pom.xml                                 |   2 +-
 helix-rest/pom.xml                                 |   4 +-
 metadata-store-directory-common/pom.xml            |   2 +-
 metrics-common/pom.xml                             |   2 +-
 .../mbeans/dynamicMBeans/DynamicMBeanProvider.java |  75 ++++---
 .../mbeans/dynamicMBeans/SimpleDynamicMetric.java  |   2 +-
 pom.xml                                            |   2 +-
 recipes/distributed-lock-manager/pom.xml           |   2 +-
 recipes/pom.xml                                    |   2 +-
 recipes/rabbitmq-consumer-group/pom.xml            |   2 +-
 recipes/rsync-replicated-file-system/pom.xml       |   2 +-
 recipes/service-discovery/pom.xml                  |   2 +-
 recipes/task-execution/pom.xml                     |   2 +-
 zookeeper-api/pom.xml                              |   2 +-
 21 files changed, 56 insertions(+), 354 deletions(-)
 delete mode 100644 helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
 delete mode 100644 helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java


[helix] 02/03: Revert "[maven-release-plugin] prepare release helix-1.0.1"

Posted by jx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jxue pushed a commit to branch release-1.0.1
in repository https://gitbox.apache.org/repos/asf/helix.git

commit 5d422eaf1ac79d8d9037289f50605a1781f19675
Author: Junkai Xue <jx...@linkedin.com>
AuthorDate: Wed Jul 15 12:54:05 2020 -0700

    Revert "[maven-release-plugin] prepare release helix-1.0.1"
    
    This reverts commit 4231a87ae8bdbe3c71b3ed8ab12853955e5d75b7.
---
 helix-admin-webapp/pom.xml                   | 2 +-
 helix-agent/pom.xml                          | 2 +-
 helix-common/pom.xml                         | 2 +-
 helix-core/pom.xml                           | 2 +-
 helix-front/pom.xml                          | 2 +-
 helix-lock/pom.xml                           | 2 +-
 helix-rest/pom.xml                           | 4 ++--
 metadata-store-directory-common/pom.xml      | 2 +-
 metrics-common/pom.xml                       | 2 +-
 pom.xml                                      | 4 ++--
 recipes/distributed-lock-manager/pom.xml     | 2 +-
 recipes/pom.xml                              | 2 +-
 recipes/rabbitmq-consumer-group/pom.xml      | 2 +-
 recipes/rsync-replicated-file-system/pom.xml | 2 +-
 recipes/service-discovery/pom.xml            | 2 +-
 recipes/task-execution/pom.xml               | 2 +-
 zookeeper-api/pom.xml                        | 2 +-
 17 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/helix-admin-webapp/pom.xml b/helix-admin-webapp/pom.xml
index e971109..f37dbfe 100644
--- a/helix-admin-webapp/pom.xml
+++ b/helix-admin-webapp/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-agent/pom.xml b/helix-agent/pom.xml
index 092656d..30b5ef1 100644
--- a/helix-agent/pom.xml
+++ b/helix-agent/pom.xml
@@ -22,7 +22,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <artifactId>helix-agent</artifactId>
   <packaging>bundle</packaging>
diff --git a/helix-common/pom.xml b/helix-common/pom.xml
index 54b5562..d84e4eb 100644
--- a/helix-common/pom.xml
+++ b/helix-common/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-core/pom.xml b/helix-core/pom.xml
index aaa987c..c4e760a 100644
--- a/helix-core/pom.xml
+++ b/helix-core/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-front/pom.xml b/helix-front/pom.xml
index 39a15eb..dd7eee5 100644
--- a/helix-front/pom.xml
+++ b/helix-front/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-lock/pom.xml b/helix-lock/pom.xml
index bc6a198..35d09d9 100644
--- a/helix-lock/pom.xml
+++ b/helix-lock/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-rest/pom.xml b/helix-rest/pom.xml
index e89a29b..7f4efc7 100644
--- a/helix-rest/pom.xml
+++ b/helix-rest/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -47,7 +47,7 @@ under the License.
     <dependency>
       <groupId>org.apache.helix</groupId>
       <artifactId>metadata-store-directory-common</artifactId>
-      <version>1.0.1</version>
+      <version>1.0.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.yaml</groupId>
diff --git a/metadata-store-directory-common/pom.xml b/metadata-store-directory-common/pom.xml
index 6d6f77d..59275cf 100644
--- a/metadata-store-directory-common/pom.xml
+++ b/metadata-store-directory-common/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/metrics-common/pom.xml b/metrics-common/pom.xml
index 3e08107..622ddfa 100644
--- a/metrics-common/pom.xml
+++ b/metrics-common/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/pom.xml b/pom.xml
index 2d56836..80f15ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@ under the License.
 
   <groupId>org.apache.helix</groupId>
   <artifactId>helix</artifactId>
-  <version>1.0.1</version>
+  <version>1.0.1-SNAPSHOT</version>
   <packaging>pom</packaging>
   <name>Apache Helix</name>
 
@@ -364,7 +364,7 @@ under the License.
     <connection>scm:git:https://git-wip-us.apache.org/repos/asf/helix.git</connection>
     <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/helix.git</developerConnection>
     <url>https://git-wip-us.apache.org/repos/asf?p=helix.git;a=summary</url>
-    <tag>helix-1.0.1</tag>
+    <tag>HEAD</tag>
   </scm>
   <issueManagement>
     <system>jira</system>
diff --git a/recipes/distributed-lock-manager/pom.xml b/recipes/distributed-lock-manager/pom.xml
index dd7effd..130db30 100644
--- a/recipes/distributed-lock-manager/pom.xml
+++ b/recipes/distributed-lock-manager/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>distributed-lock-manager</artifactId>
diff --git a/recipes/pom.xml b/recipes/pom.xml
index 9af878e..6fe052c 100644
--- a/recipes/pom.xml
+++ b/recipes/pom.xml
@@ -22,7 +22,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <groupId>org.apache.helix.recipes</groupId>
   <artifactId>recipes</artifactId>
diff --git a/recipes/rabbitmq-consumer-group/pom.xml b/recipes/rabbitmq-consumer-group/pom.xml
index f4f746b..d2d1d0e 100644
--- a/recipes/rabbitmq-consumer-group/pom.xml
+++ b/recipes/rabbitmq-consumer-group/pom.xml
@@ -24,7 +24,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>rabbitmq-consumer-group</artifactId>
diff --git a/recipes/rsync-replicated-file-system/pom.xml b/recipes/rsync-replicated-file-system/pom.xml
index dc964b2..07ab8ac 100644
--- a/recipes/rsync-replicated-file-system/pom.xml
+++ b/recipes/rsync-replicated-file-system/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>rsync-replicated-file-system</artifactId>
diff --git a/recipes/service-discovery/pom.xml b/recipes/service-discovery/pom.xml
index 7a4cb5e..7a9e921 100644
--- a/recipes/service-discovery/pom.xml
+++ b/recipes/service-discovery/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>service-discovery</artifactId>
diff --git a/recipes/task-execution/pom.xml b/recipes/task-execution/pom.xml
index 5aa911a..4515e52 100644
--- a/recipes/task-execution/pom.xml
+++ b/recipes/task-execution/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>task-execution</artifactId>
diff --git a/zookeeper-api/pom.xml b/zookeeper-api/pom.xml
index 868b1de..aed65e6 100644
--- a/zookeeper-api/pom.xml
+++ b/zookeeper-api/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.1</version>
+    <version>1.0.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 


[helix] 03/03: Remove legacy duplicate metric classes in helix-core (#1147)

Posted by jx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jxue pushed a commit to branch release-1.0.1
in repository https://gitbox.apache.org/repos/asf/helix.git

commit bd3b8541f986e45f28b4ae32225e6daf8a7b8a94
Author: Hunter Lee <hu...@linkedin.com>
AuthorDate: Wed Jul 15 12:11:23 2020 -0700

    Remove legacy duplicate metric classes in helix-core (#1147)
    
    As part of ZooKeeper API separation initiative, most metric-related classes were moved to metrics-common module. However, there were some that were left in helix-core for backward-compatibility purposes, but these were causing class conflicts at runtime. This change removes such classes.
---
 .../mbeans/dynamicMBeans/DynamicMBeanProvider.java | 237 ---------------------
 .../mbeans/dynamicMBeans/SimpleDynamicMetric.java  |  60 ------
 .../mbeans/dynamicMBeans/DynamicMBeanProvider.java |  75 ++++---
 .../mbeans/dynamicMBeans/SimpleDynamicMetric.java  |   2 +-
 4 files changed, 38 insertions(+), 336 deletions(-)

diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
deleted file mode 100644
index 407a714..0000000
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package org.apache.helix.monitoring.mbeans.dynamicMBeans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.management.Attribute;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.DynamicMBean;
-import javax.management.JMException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.ObjectName;
-
-import org.apache.helix.SystemPropertyKeys;
-import org.apache.helix.monitoring.SensorNameProvider;
-import org.apache.helix.monitoring.mbeans.MBeanRegistrar;
-import org.apache.helix.util.HelixUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Dynamic MBean provider that reporting DynamicMetric attributes
- */
-public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNameProvider {
-  protected final Logger _logger = LoggerFactory.getLogger(getClass());
-  protected static final long DEFAULT_RESET_INTERVAL_MS = 60 * 60 * 1000; // Reset time every hour
-  private static final String SENSOR_NAME_TAG = "SensorName";
-  private static final String DEFAULT_DESCRIPTION =
-      "Information on the management interface of the MBean";
-
-  // Attribute name to the DynamicMetric object mapping
-  private Map<String, DynamicMetric> _attributeMap = new HashMap<>();
-  private ObjectName _objectName = null;
-  private MBeanInfo _mBeanInfo;
-
-  /**
-   * Instantiates a new Dynamic MBean provider.
-   * @param dynamicMetrics Dynamic Metrics that are exposed by this provider
-   * @param description the MBean description
-   * @param domain the MBean domain name
-   * @param keyValuePairs the MBean object name components
-   */
-  protected synchronized boolean doRegister(Collection<DynamicMetric<?, ?>> dynamicMetrics,
-      String description, String domain, String... keyValuePairs) throws JMException {
-    return doRegister(dynamicMetrics, description,
-        MBeanRegistrar.buildObjectName(domain, keyValuePairs));
-  }
-
-  /**
-   * Instantiates a new Dynamic MBean provider.
-   * @param dynamicMetrics Dynamic Metrics that are exposed by this provider
-   * @param description the MBean description
-   * @param objectName the proposed MBean ObjectName
-   */
-  protected synchronized boolean doRegister(Collection<DynamicMetric<?, ?>> dynamicMetrics,
-      String description, ObjectName objectName) throws JMException {
-    if (_objectName != null) {
-      _logger.debug("Mbean {} has already been registered. Ignore register request.",
-          objectName.getCanonicalName());
-      return false;
-    }
-    updateAttributesInfo(dynamicMetrics, description);
-    _objectName = MBeanRegistrar.register(this, objectName);
-    return true;
-  }
-
-  protected synchronized boolean doRegister(Collection<DynamicMetric<?, ?>> dynamicMetrics,
-      ObjectName objectName) throws JMException {
-    return doRegister(dynamicMetrics, null, objectName);
-  }
-
-  /**
-   * Updates the Dynamic MBean provider with new metric list.
-   * If the pass-in metrics collection is empty, the original attributes will be removed.
-   *
-   * @param description description of the MBean
-   * @param dynamicMetrics the DynamicMetrics. Empty collection will remove the metric attributes.
-   */
-  protected void updateAttributesInfo(Collection<DynamicMetric<?, ?>> dynamicMetrics,
-      String description) {
-    if (dynamicMetrics == null) {
-      _logger.warn("Cannot update attributes info because dynamicMetrics is null.");
-      return;
-    }
-
-    List<MBeanAttributeInfo> attributeInfoList = new ArrayList<>();
-    // Use a new attribute map to avoid concurrency issue.
-    Map<String, DynamicMetric> newAttributeMap = new HashMap<>();
-
-    // Get all attributes that can be emitted by the dynamicMetrics.
-    for (DynamicMetric<?, ?> dynamicMetric : dynamicMetrics) {
-      for (MBeanAttributeInfo attributeInfo : dynamicMetric.getAttributeInfos()) {
-        // Info list to create MBean info
-        attributeInfoList.add(attributeInfo);
-        // Attribute mapping for getting attribute value when getAttribute() is called
-        newAttributeMap.put(attributeInfo.getName(), dynamicMetric);
-      }
-    }
-
-    // SensorName
-    attributeInfoList.add(new MBeanAttributeInfo(SENSOR_NAME_TAG, String.class.getName(),
-        "The name of the metric sensor", true, false, false));
-
-    MBeanConstructorInfo constructorInfo = new MBeanConstructorInfo(
-        String.format("Default %s Constructor", getClass().getSimpleName()),
-        getClass().getConstructors()[0]);
-
-    MBeanAttributeInfo[] attributesInfo = new MBeanAttributeInfo[attributeInfoList.size()];
-    attributesInfo = attributeInfoList.toArray(attributesInfo);
-
-    if (description == null) {
-      description = DEFAULT_DESCRIPTION;
-    }
-
-    _mBeanInfo = new MBeanInfo(getClass().getName(), description, attributesInfo,
-        new MBeanConstructorInfo[]{constructorInfo}, new MBeanOperationInfo[0],
-        new MBeanNotificationInfo[0]);
-
-    // Update _attributeMap reference.
-    _attributeMap = newAttributeMap;
-  }
-
-  /**
-   * Call doRegister() to finish registration MBean and the attributes.
-   */
-  public abstract DynamicMBeanProvider register() throws JMException;
-
-  /**
-   * Unregister the MBean and clean up object name record.
-   * Note that all the metric data is kept even after unregister.
-   */
-  public synchronized void unregister() {
-    MBeanRegistrar.unregister(_objectName);
-    _objectName = null;
-  }
-
-  @Override
-  public Object getAttribute(String attribute) throws AttributeNotFoundException {
-    if (SENSOR_NAME_TAG.equals(attribute)) {
-      return getSensorName();
-    }
-
-    DynamicMetric metric = _attributeMap.get(attribute);
-    if (metric == null) {
-      throw new AttributeNotFoundException("Attribute[" + attribute + "] is not found.");
-    }
-
-    return metric.getAttributeValue(attribute);
-  }
-
-  @Override
-  public AttributeList getAttributes(String[] attributes) {
-    AttributeList attributeList = new AttributeList();
-    for (String attributeName : attributes) {
-      try {
-        Object value = getAttribute(attributeName);
-        attributeList.add(new Attribute(attributeName, value));
-      } catch (AttributeNotFoundException ex) {
-        _logger.error("Failed to get attribute: " + attributeName, ex);
-      }
-    }
-    return attributeList;
-  }
-
-  @Override
-  public MBeanInfo getMBeanInfo() {
-    return _mBeanInfo;
-  }
-
-  @Override
-  public void setAttribute(Attribute attribute) {
-    // All MBeans are readonly
-    return;
-  }
-
-  @Override
-  public AttributeList setAttributes(AttributeList attributes) {
-    // All MBeans are readonly
-    return null;
-  }
-
-  @Override
-  public Object invoke(String actionName, Object[] params, String[] signature) {
-    // No operation supported
-    return null;
-  }
-
-  /**
-   * NOTE: This method is not thread-safe nor atomic.
-   * Increment the value of a given SimpleDynamicMetric by 1.
-   */
-  protected void incrementSimpleDynamicMetric(SimpleDynamicMetric<Long> metric) {
-    incrementSimpleDynamicMetric(metric, 1);
-  }
-
-  /**
-   * NOTE: This method is not thread-safe nor atomic.
-   * Increment the value of a given SimpleDynamicMetric with input value.
-   */
-  protected void incrementSimpleDynamicMetric(SimpleDynamicMetric<Long> metric, long value) {
-    metric.updateValue(metric.getValue() + value);
-  }
-
-  /**
-   * Return the interval length for the underlying reservoir used by the MBean metric configured
-   * in the system env variables. If not found, use default value.
-   */
-  protected Long getResetIntervalInMs() {
-    return HelixUtil.getSystemPropertyAsLong(SystemPropertyKeys.HELIX_MONITOR_TIME_WINDOW_LENGTH_MS,
-        DEFAULT_RESET_INTERVAL_MS);
-  }
-}
diff --git a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java b/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java
deleted file mode 100644
index 2b0f1db..0000000
--- a/helix-core/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.helix.monitoring.mbeans.dynamicMBeans;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The dynamic metric that accept and emits same type of monitor data
- *
- * @param <T> the type of the metric value
- */
-public class SimpleDynamicMetric<T> extends DynamicMetric<T, T> {
-  protected final String _metricName;
-
-  /**
-   * Instantiates a new Simple dynamic metric.
-   *
-   * @param metricName   the metric name
-   * @param metricObject the metric object
-   */
-  public SimpleDynamicMetric(String metricName, T metricObject) {
-    super(metricName, metricObject);
-    _metricName = metricName;
-  }
-
-  @Override
-  public T getAttributeValue(String attributeName) {
-    if (!attributeName.equals(_metricName)) {
-      return null;
-    }
-    return getMetricObject();
-  }
-
-  /**
-   * @return current metric value
-   */
-  public T getValue() {
-    return getMetricObject();
-  }
-
-  @Override
-  public void updateValue(T metricObject) {
-    setMetricObject(metricObject);
-  }
-}
diff --git a/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java b/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
index 8174326..7071c80 100644
--- a/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
+++ b/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/DynamicMBeanProvider.java
@@ -22,23 +22,19 @@ package org.apache.helix.monitoring.mbeans.dynamicMBeans;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import javax.management.Attribute;
 import javax.management.AttributeList;
 import javax.management.AttributeNotFoundException;
 import javax.management.DynamicMBean;
-import javax.management.InvalidAttributeValueException;
 import javax.management.JMException;
 import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanConstructorInfo;
-import javax.management.MBeanException;
 import javax.management.MBeanInfo;
 import javax.management.MBeanNotificationInfo;
 import javax.management.MBeanOperationInfo;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 
 import org.apache.helix.monitoring.SensorNameProvider;
 import org.apache.helix.monitoring.mbeans.MBeanRegistrar;
@@ -54,13 +50,12 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
   protected static final long DEFAULT_RESET_INTERVAL_MS = 60 * 60 * 1000; // Reset time every hour
   private static final String HELIX_MONITOR_TIME_WINDOW_LENGTH_MS =
       "helix.monitor.slidingTimeWindow.ms";
-
-  private static String SENSOR_NAME_TAG = "SensorName";
-  private static String DEFAULT_DESCRIPTION =
+  private static final String SENSOR_NAME_TAG = "SensorName";
+  private static final String DEFAULT_DESCRIPTION =
       "Information on the management interface of the MBean";
 
   // Attribute name to the DynamicMetric object mapping
-  private final Map<String, DynamicMetric> _attributeMap = new HashMap<>();
+  private Map<String, DynamicMetric> _attributeMap = new HashMap<>();
   private ObjectName _objectName = null;
   private MBeanInfo _mBeanInfo;
 
@@ -90,7 +85,7 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
           objectName.getCanonicalName());
       return false;
     }
-    updateAttributtInfos(dynamicMetrics, description);
+    updateAttributesInfo(dynamicMetrics, description);
     _objectName = MBeanRegistrar.register(this, objectName);
     return true;
   }
@@ -101,26 +96,30 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
   }
 
   /**
-   * Update the Dynamic MBean provider with new metric list.
+   * Updates the Dynamic MBean provider with new metric list.
+   * If the pass-in metrics collection is empty, the original attributes will be removed.
+   *
    * @param description description of the MBean
-   * @param dynamicMetrics the DynamicMetrics
+   * @param dynamicMetrics the DynamicMetrics. Empty collection will remove the metric attributes.
    */
-  private void updateAttributtInfos(Collection<DynamicMetric<?, ?>> dynamicMetrics,
+  protected void updateAttributesInfo(Collection<DynamicMetric<?, ?>> dynamicMetrics,
       String description) {
-    _attributeMap.clear();
+    if (dynamicMetrics == null) {
+      _logger.warn("Cannot update attributes info because dynamicMetrics is null.");
+      return;
+    }
 
-    // get all attributes that can be emit by the dynamicMetrics.
     List<MBeanAttributeInfo> attributeInfoList = new ArrayList<>();
-    if (dynamicMetrics != null) {
-      for (DynamicMetric dynamicMetric : dynamicMetrics) {
-        Iterator<MBeanAttributeInfo> iter = dynamicMetric.getAttributeInfos().iterator();
-        while (iter.hasNext()) {
-          MBeanAttributeInfo attributeInfo = iter.next();
-          // Info list to create MBean info
-          attributeInfoList.add(attributeInfo);
-          // Attribute mapping for getting attribute value when getAttribute() is called
-          _attributeMap.put(attributeInfo.getName(), dynamicMetric);
-        }
+    // Use a new attribute map to avoid concurrency issue.
+    Map<String, DynamicMetric> newAttributeMap = new HashMap<>();
+
+    // Get all attributes that can be emitted by the dynamicMetrics.
+    for (DynamicMetric<?, ?> dynamicMetric : dynamicMetrics) {
+      for (MBeanAttributeInfo attributeInfo : dynamicMetric.getAttributeInfos()) {
+        // Info list to create MBean info
+        attributeInfoList.add(attributeInfo);
+        // Attribute mapping for getting attribute value when getAttribute() is called
+        newAttributeMap.put(attributeInfo.getName(), dynamicMetric);
       }
     }
 
@@ -132,16 +131,19 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
         String.format("Default %s Constructor", getClass().getSimpleName()),
         getClass().getConstructors()[0]);
 
-    MBeanAttributeInfo[] attributeInfos = new MBeanAttributeInfo[attributeInfoList.size()];
-    attributeInfos = attributeInfoList.toArray(attributeInfos);
+    MBeanAttributeInfo[] attributesInfo = new MBeanAttributeInfo[attributeInfoList.size()];
+    attributesInfo = attributeInfoList.toArray(attributesInfo);
 
     if (description == null) {
       description = DEFAULT_DESCRIPTION;
     }
 
-    _mBeanInfo = new MBeanInfo(getClass().getName(), description, attributeInfos,
+    _mBeanInfo = new MBeanInfo(getClass().getName(), description, attributesInfo,
         new MBeanConstructorInfo[]{constructorInfo}, new MBeanOperationInfo[0],
         new MBeanNotificationInfo[0]);
+
+    // Update _attributeMap reference.
+    _attributeMap = newAttributeMap;
   }
 
   /**
@@ -159,17 +161,17 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
   }
 
   @Override
-  public Object getAttribute(String attribute)
-      throws AttributeNotFoundException, MBeanException, ReflectionException {
+  public Object getAttribute(String attribute) 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.");
     }
 
-    return _attributeMap.get(attribute).getAttributeValue(attribute);
+    return metric.getAttributeValue(attribute);
   }
 
   @Override
@@ -179,7 +181,7 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
       try {
         Object value = getAttribute(attributeName);
         attributeList.add(new Attribute(attributeName, value));
-      } catch (AttributeNotFoundException | MBeanException | ReflectionException ex) {
+      } catch (AttributeNotFoundException ex) {
         _logger.error("Failed to get attribute: " + attributeName, ex);
       }
     }
@@ -192,9 +194,7 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
   }
 
   @Override
-  public void setAttribute(Attribute attribute)
-      throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException,
-             ReflectionException {
+  public void setAttribute(Attribute attribute) {
     // All MBeans are readonly
     return;
   }
@@ -206,8 +206,7 @@ public abstract class DynamicMBeanProvider implements DynamicMBean, SensorNamePr
   }
 
   @Override
-  public Object invoke(String actionName, Object[] params, String[] signature)
-      throws MBeanException, ReflectionException {
+  public Object invoke(String actionName, Object[] params, String[] signature) {
     // No operation supported
     return null;
   }
diff --git a/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java b/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java
index 1be6a21..2b0f1db 100644
--- a/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java
+++ b/metrics-common/src/main/java/org/apache/helix/monitoring/mbeans/dynamicMBeans/SimpleDynamicMetric.java
@@ -25,7 +25,7 @@ package org.apache.helix.monitoring.mbeans.dynamicMBeans;
  * @param <T> the type of the metric value
  */
 public class SimpleDynamicMetric<T> extends DynamicMetric<T, T> {
-  private final String _metricName;
+  protected final String _metricName;
 
   /**
    * Instantiates a new Simple dynamic metric.


[helix] 01/03: Revert "[maven-release-plugin] prepare for next development iteration"

Posted by jx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jxue pushed a commit to branch release-1.0.1
in repository https://gitbox.apache.org/repos/asf/helix.git

commit 3e4069a2c12214898d0ec64a438cabccabc2b332
Author: Junkai Xue <jx...@linkedin.com>
AuthorDate: Wed Jul 15 12:53:48 2020 -0700

    Revert "[maven-release-plugin] prepare for next development iteration"
    
    This reverts commit e60b8c6247352c601b9b5556a72301cd88c6df2c.
---
 helix-admin-webapp/pom.xml                   | 2 +-
 helix-agent/pom.xml                          | 2 +-
 helix-common/pom.xml                         | 2 +-
 helix-core/pom.xml                           | 2 +-
 helix-front/pom.xml                          | 2 +-
 helix-lock/pom.xml                           | 2 +-
 helix-rest/pom.xml                           | 4 ++--
 metadata-store-directory-common/pom.xml      | 2 +-
 metrics-common/pom.xml                       | 2 +-
 pom.xml                                      | 4 ++--
 recipes/distributed-lock-manager/pom.xml     | 2 +-
 recipes/pom.xml                              | 2 +-
 recipes/rabbitmq-consumer-group/pom.xml      | 2 +-
 recipes/rsync-replicated-file-system/pom.xml | 2 +-
 recipes/service-discovery/pom.xml            | 2 +-
 recipes/task-execution/pom.xml               | 2 +-
 zookeeper-api/pom.xml                        | 2 +-
 17 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/helix-admin-webapp/pom.xml b/helix-admin-webapp/pom.xml
index b7048fe..e971109 100644
--- a/helix-admin-webapp/pom.xml
+++ b/helix-admin-webapp/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-agent/pom.xml b/helix-agent/pom.xml
index 31a3921..092656d 100644
--- a/helix-agent/pom.xml
+++ b/helix-agent/pom.xml
@@ -22,7 +22,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <artifactId>helix-agent</artifactId>
   <packaging>bundle</packaging>
diff --git a/helix-common/pom.xml b/helix-common/pom.xml
index 337e976..54b5562 100644
--- a/helix-common/pom.xml
+++ b/helix-common/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-core/pom.xml b/helix-core/pom.xml
index 2a5f24e..aaa987c 100644
--- a/helix-core/pom.xml
+++ b/helix-core/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-front/pom.xml b/helix-front/pom.xml
index f05eb19..39a15eb 100644
--- a/helix-front/pom.xml
+++ b/helix-front/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-lock/pom.xml b/helix-lock/pom.xml
index 9f79ed4..bc6a198 100644
--- a/helix-lock/pom.xml
+++ b/helix-lock/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/helix-rest/pom.xml b/helix-rest/pom.xml
index 2f6545a..e89a29b 100644
--- a/helix-rest/pom.xml
+++ b/helix-rest/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -47,7 +47,7 @@ under the License.
     <dependency>
       <groupId>org.apache.helix</groupId>
       <artifactId>metadata-store-directory-common</artifactId>
-      <version>1.0.2-SNAPSHOT</version>
+      <version>1.0.1</version>
     </dependency>
     <dependency>
       <groupId>org.yaml</groupId>
diff --git a/metadata-store-directory-common/pom.xml b/metadata-store-directory-common/pom.xml
index e216b67..6d6f77d 100644
--- a/metadata-store-directory-common/pom.xml
+++ b/metadata-store-directory-common/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/metrics-common/pom.xml b/metrics-common/pom.xml
index d328168..3e08107 100644
--- a/metrics-common/pom.xml
+++ b/metrics-common/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/pom.xml b/pom.xml
index bb185e7..2d56836 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@ under the License.
 
   <groupId>org.apache.helix</groupId>
   <artifactId>helix</artifactId>
-  <version>1.0.2-SNAPSHOT</version>
+  <version>1.0.1</version>
   <packaging>pom</packaging>
   <name>Apache Helix</name>
 
@@ -364,7 +364,7 @@ under the License.
     <connection>scm:git:https://git-wip-us.apache.org/repos/asf/helix.git</connection>
     <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/helix.git</developerConnection>
     <url>https://git-wip-us.apache.org/repos/asf?p=helix.git;a=summary</url>
-    <tag>HEAD</tag>
+    <tag>helix-1.0.1</tag>
   </scm>
   <issueManagement>
     <system>jira</system>
diff --git a/recipes/distributed-lock-manager/pom.xml b/recipes/distributed-lock-manager/pom.xml
index 417a9cf..dd7effd 100644
--- a/recipes/distributed-lock-manager/pom.xml
+++ b/recipes/distributed-lock-manager/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
 
   <artifactId>distributed-lock-manager</artifactId>
diff --git a/recipes/pom.xml b/recipes/pom.xml
index 04f530f..9af878e 100644
--- a/recipes/pom.xml
+++ b/recipes/pom.xml
@@ -22,7 +22,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <groupId>org.apache.helix.recipes</groupId>
   <artifactId>recipes</artifactId>
diff --git a/recipes/rabbitmq-consumer-group/pom.xml b/recipes/rabbitmq-consumer-group/pom.xml
index 461aaa2..f4f746b 100644
--- a/recipes/rabbitmq-consumer-group/pom.xml
+++ b/recipes/rabbitmq-consumer-group/pom.xml
@@ -24,7 +24,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
 
   <artifactId>rabbitmq-consumer-group</artifactId>
diff --git a/recipes/rsync-replicated-file-system/pom.xml b/recipes/rsync-replicated-file-system/pom.xml
index e10b2b9..dc964b2 100644
--- a/recipes/rsync-replicated-file-system/pom.xml
+++ b/recipes/rsync-replicated-file-system/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
 
   <artifactId>rsync-replicated-file-system</artifactId>
diff --git a/recipes/service-discovery/pom.xml b/recipes/service-discovery/pom.xml
index 8d9c10c..7a4cb5e 100644
--- a/recipes/service-discovery/pom.xml
+++ b/recipes/service-discovery/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
 
   <artifactId>service-discovery</artifactId>
diff --git a/recipes/task-execution/pom.xml b/recipes/task-execution/pom.xml
index 5d34f46..5aa911a 100644
--- a/recipes/task-execution/pom.xml
+++ b/recipes/task-execution/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix.recipes</groupId>
     <artifactId>recipes</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
 
   <artifactId>task-execution</artifactId>
diff --git a/zookeeper-api/pom.xml b/zookeeper-api/pom.xml
index b71ce9c..868b1de 100644
--- a/zookeeper-api/pom.xml
+++ b/zookeeper-api/pom.xml
@@ -21,7 +21,7 @@ under the License.
   <parent>
     <groupId>org.apache.helix</groupId>
     <artifactId>helix</artifactId>
-    <version>1.0.2-SNAPSHOT</version>
+    <version>1.0.1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>