[GitHub] storm pull request: STORM-1229: port backtype.storm.metric.testing...

2016-04-01 Thread abhishekagarwal87
Github user abhishekagarwal87 commented on the pull request:

https://github.com/apache/storm/pull/1238#issuecomment-204406420
  
@revans2 / @knusbaum  - can you review this? 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] storm pull request: STORM-1229: port backtype.storm.metric.testing...

2016-03-20 Thread abhishekagarwal87
Github user abhishekagarwal87 commented on the pull request:

https://github.com/apache/storm/pull/1238#issuecomment-199126076
  
@hustfxj the implementation of handleDataPoints may not be straightforward 
with AtomicReferences. I found emulating clojure atom operators verbatim tricky 
so I did it in-place in java fashion. Result code was not that verbose so I 
just left it there. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] storm pull request: STORM-1229: port backtype.storm.metric.testing...

2016-03-20 Thread abhishekagarwal87
Github user abhishekagarwal87 commented on a diff in the pull request:

https://github.com/apache/storm/pull/1238#discussion_r56782340
  
--- Diff: 
storm-core/test/jvm/org/apache/storm/metric/FakeMetricConsumer.java ---
@@ -0,0 +1,88 @@
+/**
+ * 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.
+ */
+package org.apache.storm.metric;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Table;
+
+import org.apache.storm.metric.api.IMetricsConsumer;
+import org.apache.storm.task.IErrorReporter;
+import org.apache.storm.task.TopologyContext;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class FakeMetricConsumer implements IMetricsConsumer {
+
+public static final Table> 
buffer = HashBasedTable.create();
--- End diff --

It is used in testing. The tests don't have access to the instance which 
are prepared inside the storm. That is why it is declared `public static` so 
that tests can access the metrics.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] storm pull request: STORM-1229: port backtype.storm.metric.testing...

2016-03-20 Thread hustfxj
Github user hustfxj commented on the pull request:

https://github.com/apache/storm/pull/1238#issuecomment-199075001
  
@abhishekagarwal87  thank you. It have better use AtomicReference to 
replace the Map, then we can avoid to use  the "synchronized". And  do 
HashBasedTable.create() generate the struct "HashMap>", but 
not "Multimap>" ? 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] storm pull request: STORM-1229: port backtype.storm.metric.testing...

2016-03-20 Thread unsleepy22
Github user unsleepy22 commented on a diff in the pull request:

https://github.com/apache/storm/pull/1238#discussion_r56766748
  
--- Diff: 
storm-core/test/jvm/org/apache/storm/metric/FakeMetricConsumer.java ---
@@ -0,0 +1,88 @@
+/**
+ * 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.
+ */
+package org.apache.storm.metric;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Table;
+
+import org.apache.storm.metric.api.IMetricsConsumer;
+import org.apache.storm.task.IErrorReporter;
+import org.apache.storm.task.TopologyContext;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class FakeMetricConsumer implements IMetricsConsumer {
+
+public static final Table> 
buffer = HashBasedTable.create();
--- End diff --

why is this static? can't we make it an instance field?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] storm pull request: STORM-1229: port backtype.storm.metric.testing...

2016-03-19 Thread abhishekagarwal87
GitHub user abhishekagarwal87 opened a pull request:

https://github.com/apache/storm/pull/1238

STORM-1229: port backtype.storm.metric.testing to java



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

$ git pull https://github.com/abhishekagarwal87/storm metric-testing

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

https://github.com/apache/storm/pull/1238.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 #1238


commit 07e1b231e37217705add955d76b57fa530b99955
Author: Abhishek Agarwal 
Date:   2016-03-19T19:47:33Z

STORM-1229: port backtype.storm.metric.testing to java




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---