You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by olegz <gi...@git.apache.org> on 2016/04/05 22:39:16 UTC

[GitHub] nifi pull request: NIFI-1690 Changed MonitorMemory to use allowabl...

GitHub user olegz opened a pull request:

    https://github.com/apache/nifi/pull/328

    NIFI-1690 Changed MonitorMemory to use allowable values for pool names

    - removed dead code from MonitorMemory
    - added MonitorMemoryTest
    - minor refactoring in MonitorMemory
    - initial fix for NIFI-1731 (WARN logging) that was required by MonitorMemoryTest

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/olegz/nifi NIFI-1690

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/328.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #328
    
----
commit 837e17547c40005bf867ffccfd211d2a8ef8ffed
Author: Oleg Zhurakousky <ol...@suitcase.io>
Date:   2016-04-05T18:24:46Z

    NIFI-1690 Changed MonitorMemory to use allowable values for pool names
    - removed dead code from MonitorMemory
    - added MonitorMemoryTest
    - minor refactoring in MonitorMemory
    - initial fix for NIFI-1731 (WARN logging) that was required by MonitorMemoryTest

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #328: NIFI-1690 Changed MonitorMemory to use allowable values for...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on the issue:

    https://github.com/apache/nifi/pull/328
  
    Merged and closed. Will do the same for [PR 533](https://github.com/apache/nifi/pull/533). 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67149210
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -154,30 +164,21 @@ public void onConfigured(final ConfigurationContext config) throws Initializatio
             }
     
             final List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    -        for (final MemoryPoolMXBean bean : memoryPoolBeans) {
    -            final String memoryPoolName = bean.getName();
    +        for (int i = 0; i < memoryPoolBeans.size() && monitoredBean == null; i++) {
    +            MemoryPoolMXBean memoryPoolBean = memoryPoolBeans.get(i);
    +            String memoryPoolName = memoryPoolBean.getName();
                 if (desiredMemoryPoolName.equals(memoryPoolName)) {
    -                monitoredBean = bean;
    -                if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    -                    final long bytes = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    -                    if (bean.isCollectionUsageThresholdSupported()) {
    -                        bean.setCollectionUsageThreshold(bytes);
    -                    }
    -                } else {
    -                    final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
    -                    final double pct = Double.parseDouble(percentage) / 100D;
    -                    final long calculatedThreshold = (long) (bean.getUsage().getMax() * pct);
    -                    if (bean.isCollectionUsageThresholdSupported()) {
    -                        bean.setCollectionUsageThreshold(calculatedThreshold);
    +                monitoredBean = memoryPoolBean;
    +                if (memoryPoolBean.isCollectionUsageThresholdSupported()) {
    +                    long calculatedThreshold;
    +                    if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    +                        calculatedThreshold = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    +                    } else {
    +                        final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
    +                        final double pct = Double.parseDouble(percentage) / 100D;
    --- End diff --
    
    As you can see those are old code bits (just moved around slightly), but let me see, since your point is still valid.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67149454
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -91,12 +92,21 @@
             + " that the memory pool is exceeding this threshold.")
     public class MonitorMemory extends AbstractReportingTask {
     
    +    private static final AllowableValue[] memPoolAllowableValues;
    +
    +    static {
    +        List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    +        memPoolAllowableValues = new AllowableValue[memoryPoolBeans.size()];
    +        for (int i = 0; i < memPoolAllowableValues.length; i++) {
    +            memPoolAllowableValues[i] = new AllowableValue(memoryPoolBeans.get(i).getName());
    +        }
    +    }
    +
         public static final PropertyDescriptor MEMORY_POOL_PROPERTY = new PropertyDescriptor.Builder()
                 .name("Memory Pool")
                 .description("The name of the JVM Memory Pool to monitor")
    --- End diff --
    
    One thing you and I always agreed on, so yeah, why not?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #328: NIFI-1690 Changed MonitorMemory to use allowable values for...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on the issue:

    https://github.com/apache/nifi/pull/328
  
    @alopresto all is addressed. Let me know.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67149972
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -154,30 +164,21 @@ public void onConfigured(final ConfigurationContext config) throws Initializatio
             }
     
             final List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    -        for (final MemoryPoolMXBean bean : memoryPoolBeans) {
    -            final String memoryPoolName = bean.getName();
    +        for (int i = 0; i < memoryPoolBeans.size() && monitoredBean == null; i++) {
    +            MemoryPoolMXBean memoryPoolBean = memoryPoolBeans.get(i);
    +            String memoryPoolName = memoryPoolBean.getName();
                 if (desiredMemoryPoolName.equals(memoryPoolName)) {
    -                monitoredBean = bean;
    -                if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    -                    final long bytes = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    --- End diff --
    
    Andy, just realized, your comment is on the removed code, so no longer valid, correct?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67079817
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -91,12 +92,21 @@
             + " that the memory pool is exceeding this threshold.")
     public class MonitorMemory extends AbstractReportingTask {
     
    +    private static final AllowableValue[] memPoolAllowableValues;
    +
    +    static {
    +        List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    +        memPoolAllowableValues = new AllowableValue[memoryPoolBeans.size()];
    +        for (int i = 0; i < memPoolAllowableValues.length; i++) {
    +            memPoolAllowableValues[i] = new AllowableValue(memoryPoolBeans.get(i).getName());
    +        }
    +    }
    +
         public static final PropertyDescriptor MEMORY_POOL_PROPERTY = new PropertyDescriptor.Builder()
                 .name("Memory Pool")
                 .description("The name of the JVM Memory Pool to monitor")
    --- End diff --
    
    Is this a good time to add a `displayName` attribute for future-proofing?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request: NIFI-1690 Changed MonitorMemory to use allowabl...

Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r58706787
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -91,12 +92,22 @@
             + " that the memory pool is exceeding this threshold.")
     public class MonitorMemory extends AbstractReportingTask {
     
    +    private static final AllowableValue[] memPoolAllowableValues;
    +
    +    static {
    +        List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    +        memPoolAllowableValues = new AllowableValue[memoryPoolBeans.size()];
    +        for (int i = 0; i < memPoolAllowableValues.length; i++) {
    +            memPoolAllowableValues[i] = new AllowableValue(memoryPoolBeans.get(i).getName());
    +        }
    +    }
    +
         public static final PropertyDescriptor MEMORY_POOL_PROPERTY = new PropertyDescriptor.Builder()
                 .name("Memory Pool")
                 .description("The name of the JVM Memory Pool to monitor")
                 .required(true)
    -            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    -            .defaultValue(null)
    +            .allowableValues(memPoolAllowableValues)
    +            .defaultValue(memPoolAllowableValues.length == 0 ? null : memPoolAllowableValues[0].getValue())
    --- End diff --
    
    I think we're better off simply not having a default value.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67150175
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -154,30 +164,21 @@ public void onConfigured(final ConfigurationContext config) throws Initializatio
             }
     
             final List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    -        for (final MemoryPoolMXBean bean : memoryPoolBeans) {
    -            final String memoryPoolName = bean.getName();
    +        for (int i = 0; i < memoryPoolBeans.size() && monitoredBean == null; i++) {
    +            MemoryPoolMXBean memoryPoolBean = memoryPoolBeans.get(i);
    +            String memoryPoolName = memoryPoolBean.getName();
                 if (desiredMemoryPoolName.equals(memoryPoolName)) {
    -                monitoredBean = bean;
    -                if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    -                    final long bytes = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    -                    if (bean.isCollectionUsageThresholdSupported()) {
    -                        bean.setCollectionUsageThreshold(bytes);
    -                    }
    -                } else {
    -                    final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
    -                    final double pct = Double.parseDouble(percentage) / 100D;
    -                    final long calculatedThreshold = (long) (bean.getUsage().getMax() * pct);
    -                    if (bean.isCollectionUsageThresholdSupported()) {
    -                        bean.setCollectionUsageThreshold(calculatedThreshold);
    +                monitoredBean = memoryPoolBean;
    +                if (memoryPoolBean.isCollectionUsageThresholdSupported()) {
    +                    long calculatedThreshold;
    +                    if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    +                        calculatedThreshold = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    +                    } else {
    +                        final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
    +                        final double pct = Double.parseDouble(percentage) / 100D;
    --- End diff --
    
    Yes, it uses custom _ThresholdValidator_ (line 236) where those checks are performed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67210183
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -154,30 +164,21 @@ public void onConfigured(final ConfigurationContext config) throws Initializatio
             }
     
             final List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    -        for (final MemoryPoolMXBean bean : memoryPoolBeans) {
    -            final String memoryPoolName = bean.getName();
    +        for (int i = 0; i < memoryPoolBeans.size() && monitoredBean == null; i++) {
    +            MemoryPoolMXBean memoryPoolBean = memoryPoolBeans.get(i);
    +            String memoryPoolName = memoryPoolBean.getName();
                 if (desiredMemoryPoolName.equals(memoryPoolName)) {
    -                monitoredBean = bean;
    -                if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    -                    final long bytes = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    --- End diff --
    
    Sorry, meant to put it on line 178 below. Same code is still present. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #328: NIFI-1690 Changed MonitorMemory to use allowable values for...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on the issue:

    https://github.com/apache/nifi/pull/328
  
    @alopresto just fixed it. Took me a while to figure out what's going on but you can read some details here: https://issues.apache.org/jira/browse/NIFI-1730 (last comment). Also, I am now going to have to make a separate PR for 0.x. Arghhhhhhh


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67093804
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -154,30 +164,21 @@ public void onConfigured(final ConfigurationContext config) throws Initializatio
             }
     
             final List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    -        for (final MemoryPoolMXBean bean : memoryPoolBeans) {
    -            final String memoryPoolName = bean.getName();
    +        for (int i = 0; i < memoryPoolBeans.size() && monitoredBean == null; i++) {
    +            MemoryPoolMXBean memoryPoolBean = memoryPoolBeans.get(i);
    +            String memoryPoolName = memoryPoolBean.getName();
                 if (desiredMemoryPoolName.equals(memoryPoolName)) {
    -                monitoredBean = bean;
    -                if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    -                    final long bytes = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    -                    if (bean.isCollectionUsageThresholdSupported()) {
    -                        bean.setCollectionUsageThreshold(bytes);
    -                    }
    -                } else {
    -                    final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
    -                    final double pct = Double.parseDouble(percentage) / 100D;
    -                    final long calculatedThreshold = (long) (bean.getUsage().getMax() * pct);
    -                    if (bean.isCollectionUsageThresholdSupported()) {
    -                        bean.setCollectionUsageThreshold(calculatedThreshold);
    +                monitoredBean = memoryPoolBean;
    +                if (memoryPoolBean.isCollectionUsageThresholdSupported()) {
    +                    long calculatedThreshold;
    +                    if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    +                        calculatedThreshold = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    +                    } else {
    +                        final String percentage = thresholdValue.substring(0, thresholdValue.length() - 1);
    +                        final double pct = Double.parseDouble(percentage) / 100D;
    --- End diff --
    
    Can this ever throw a `NumberFormatException` or an `IndexOutOfBoundsException`? It looks like it's reading from a string that may be empty or have a unit abbreviation that is more than one character. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #328: NIFI-1690 Changed MonitorMemory to use allowable values for...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on the issue:

    https://github.com/apache/nifi/pull/328
  
    Thanks @olegz . If you rebase and squash, I'll verify and merge. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/328


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67076846
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/pom.xml ---
    @@ -1,60 +1,69 @@
    -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    -    <!--
    -      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.
    -    -->
    -    <modelVersion>4.0.0</modelVersion>
    -    <parent>
    -        <groupId>org.apache.nifi</groupId>
    -        <artifactId>nifi-standard-bundle</artifactId>
    -        <version>1.0.0-SNAPSHOT</version>
    -    </parent>
    -    <artifactId>nifi-standard-reporting-tasks</artifactId>
    -    <packaging>jar</packaging>
    -    <dependencies>
    -        <dependency>
    -            <groupId>org.apache.nifi</groupId>
    -            <artifactId>nifi-api</artifactId>
    -        </dependency>
    -        <dependency>
    -            <groupId>org.apache.nifi</groupId>
    -            <artifactId>nifi-utils</artifactId>
    -        </dependency>
    -        <dependency>
    -            <groupId>org.apache.nifi</groupId>
    -            <artifactId>nifi-properties</artifactId>
    -        </dependency>
    -        <dependency>
    -            <groupId>org.apache.nifi</groupId>
    -            <artifactId>nifi-processor-utils</artifactId>
    -        </dependency>
    -        <dependency>
    -            <groupId>com.yammer.metrics</groupId>
    -            <artifactId>metrics-ganglia</artifactId>
    -        </dependency>
    -        <dependency>
    -            <groupId>org.slf4j</groupId>
    -            <artifactId>slf4j-api</artifactId>
    -        </dependency>
    -        <dependency>
    -            <groupId>org.apache.nifi</groupId>
    -            <artifactId>nifi-mock</artifactId>
    -            <scope>test</scope>
    -        </dependency>
    -        <dependency>
    -            <groupId>org.mockito</groupId>
    -            <artifactId>mockito-all</artifactId>
    -            <scope>test</scope>
    -        </dependency>
    -    </dependencies>
    +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    +	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    +	<!-- 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. -->
    +	<modelVersion>4.0.0</modelVersion>
    +	<parent>
    +		<groupId>org.apache.nifi</groupId>
    +		<artifactId>nifi-standard-bundle</artifactId>
    +		<version>1.0.0-SNAPSHOT</version>
    +	</parent>
    +	<artifactId>nifi-standard-reporting-tasks</artifactId>
    +	<packaging>jar</packaging>
    +	<dependencies>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-framework-core</artifactId>
    +			<version>${project.version}</version>
    +			<scope>test</scope>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-nar-utils</artifactId>
    +			<scope>test</scope>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-api</artifactId>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-utils</artifactId>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-properties</artifactId>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-processor-utils</artifactId>
    +		</dependency>
    +		<dependency>
    +			<groupId>com.yammer.metrics</groupId>
    +			<artifactId>metrics-ganglia</artifactId>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.slf4j</groupId>
    +			<artifactId>slf4j-api</artifactId>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.apache.nifi</groupId>
    +			<artifactId>nifi-mock</artifactId>
    +			<scope>test</scope>
    +		</dependency>
    +		<dependency>
    +			<groupId>org.mockito</groupId>
    +			<artifactId>mockito-all</artifactId>
    +			<scope>test</scope>
    +		</dependency>
    +
    +	</dependencies>
    --- End diff --
    
    Looks like there are some formatting changes here that is throwing the diff out of whack. I saw that there was only one significant difference -- the following block was added: 
    
    ```
    		<dependency>
    			<groupId>org.apache.nifi</groupId>
    			<artifactId>nifi-framework-core</artifactId>
    			<version>${project.version}</version>
    			<scope>test</scope>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.nifi</groupId>
    			<artifactId>nifi-nar-utils</artifactId>
    			<scope>test</scope>
    		</dependency>
    ```
    
    Can you revert and just insert these lines?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #328: NIFI-1690 Changed MonitorMemory to use allowable values for...

Posted by alopresto <gi...@git.apache.org>.
Github user alopresto commented on the issue:

    https://github.com/apache/nifi/pull/328
  
    I've tried to build this locally twice (clean checkouts and everything). It is failing with a compilation error in `MonitorMemoryTest` saying that `UserService` cannot be found. I had to clean up a couple checkstyle violations in `nifi-web-api` to get to that point. Those fixes are available [here](https://github.com/alopresto/nifi/commit/f042735d094bb2a14bb7e05bc9ebc1090bfd175f). 
    
    The compilation error is below:
    
    ```
    [INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ nifi-standard-reporting-tasks ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 3 source files to /Users/alopresto/Workspace/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/target/test-classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] /Users/alopresto/Workspace/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/test/java/org/apache/nifi/controller/MonitorMemoryTest.java:[28,36] error: cannot find symbol
    [ERROR]   symbol:   class UserService
      location: package org.apache.nifi.admin.service
    /Users/alopresto/Workspace/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/test/java/org/apache/nifi/controller/MonitorMemoryTest.java:[136,21] error: cannot find symbol
    [INFO] 2 errors
    ```
    
    Any thoughts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #328: NIFI-1690 Changed MonitorMemory to use allowable val...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/328#discussion_r67149312
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/MonitorMemory.java ---
    @@ -154,30 +164,21 @@ public void onConfigured(final ConfigurationContext config) throws Initializatio
             }
     
             final List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans();
    -        for (final MemoryPoolMXBean bean : memoryPoolBeans) {
    -            final String memoryPoolName = bean.getName();
    +        for (int i = 0; i < memoryPoolBeans.size() && monitoredBean == null; i++) {
    +            MemoryPoolMXBean memoryPoolBean = memoryPoolBeans.get(i);
    +            String memoryPoolName = memoryPoolBean.getName();
                 if (desiredMemoryPoolName.equals(memoryPoolName)) {
    -                monitoredBean = bean;
    -                if (DATA_SIZE_PATTERN.matcher(thresholdValue).matches()) {
    -                    final long bytes = DataUnit.parseDataSize(thresholdValue, DataUnit.B).longValue();
    --- End diff --
    
    Apparently yes, since these are old code bits as well, but looking


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #328: NIFI-1690 Changed MonitorMemory to use allowable values for...

Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on the issue:

    https://github.com/apache/nifi/pull/328
  
    @alopresto all done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---