{"action":"created","comment":{"url":"https://api.github.com/repos/apache/storm/pulls/comments/55269210","id":55269210,"diff_hunk":"@@ -0,0 +1,604 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.apache.storm.daemon;\n+\n+import com.codahale.metrics.MetricRegistry;\n+import org.apache.storm.Config;\n+import org.apache.storm.Constants;\n+import org.apache.storm.Thrift;\n+import org.apache.storm.cluster.IStormClusterState;\n+import org.apache.storm.daemon.metrics.MetricsUtils;\n+import org.apache.storm.daemon.metrics.reporters.PreparableReporter;\n+import org.apache.storm.generated.*;\n+import org.apache.storm.generated.StormBase;\n+import org.apache.storm.metric.EventLoggerBolt;\n+import org.apache.storm.metric.MetricsConsumerBolt;\n+import org.apache.storm.metric.SystemBolt;\n+import org.apache.storm.security.auth.IAuthorizer;\n+import org.apache.storm.task.IBolt;\n+import org.apache.storm.testing.NonRichBoltTracker;\n+import org.apache.storm.utils.ConfigUtils;\n+import org.apache.storm.utils.IPredicate;\n+import org.apache.storm.utils.ThriftTopologyUtils;\n+import org.apache.storm.utils.Utils;\n+import org.json.simple.JSONValue;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.util.*;\n+\n+public class StormCommon {\n+    // A singleton instance allows us to mock delegated static methods in our\n+    // tests by subclassing.\n+    private static StormCommon _instance = new StormCommon();\n+\n+    /**\n+     * Provide an instance of this class for delegates to use.  To mock out\n+     * delegated methods, provide an instance of a subclass that overrides the\n+     * implementation of the delegated method.\n+     * @param common a StormCommon instance\n+     * @return the previously set instance\n+     */\n+    public static StormCommon setInstance(StormCommon common) {\n+        StormCommon oldInstance = _instance;\n+        _instance = common;\n+        return oldInstance;\n+    }\n+\n+    private static final Logger LOG = LoggerFactory.getLogger(StormCommon.class);\n+\n+    public static final String ACKER_COMPONENT_ID = Acker.ACKER_COMPONENT_ID;\n+    public static final String ACKER_INIT_STREAM_ID = Acker.ACKER_INIT_STREAM_ID;\n+    public static final String ACKER_ACK_STREAM_ID = Acker.ACKER_ACK_STREAM_ID;\n+    public static final String ACKER_FAIL_STREAM_ID = Acker.ACKER_FAIL_STREAM_ID;\n+\n+    public static final String SYSTEM_STREAM_ID = \"__system\";\n+\n+    public static final String EVENTLOGGER_COMPONENT_ID = \"__eventlogger\";\n+    public static final String EVENTLOGGER_STREAM_ID = \"__eventlog\";\n+\n+    public static void startMetricsReporter(PreparableReporter report, Map conf) {\n+        report.prepare(new MetricRegistry(), conf);\n+        report.start();\n+        LOG.info(\"Started statistics report plugin...\");\n+    }\n+\n+    public static void startMetricsReporters(Map conf) {\n+        List<PreparableReporter> reporters = MetricsUtils.getPreparableReporters(conf);\n+        for (PreparableReporter reporter : reporters) {\n+            startMetricsReporter(reporter, conf);\n+        }\n+    }","path":"storm-core/src/jvm/org/apache/storm/daemon/StormCommon.java","position":86,"original_position":86,"commit_id":"eca27bc435a7002375a9f8682174afbacf69fc89","original_commit_id":"eca27bc435a7002375a9f8682174afbacf69fc89","user":{"login":"revans2","id":3441321,"avatar_url":"https://avatars.githubusercontent.com/u/3441321?v=3","gravatar_id":"","url":"https://api.github.com/users/revans2","html_url":"https://github.com/revans2","followers_url":"https://api.github.com/users/revans2/followers","following_url":"https://api.github.com/users/revans2/following{/other_user}","gists_url":"https://api.github.com/users/revans2/gists{/gist_id}","starred_url":"https://api.github.com/users/revans2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/revans2/subscriptions","organizations_url":"https://api.github.com/users/revans2/orgs","repos_url":"https://api.github.com/users/revans2/repos","events_url":"https://api.github.com/users/revans2/events{/privacy}","received_events_url":"https://api.github.com/users/revans2/received_events","type":"User","site_admin":false},"body":"The metrics code has moved to another file already.  these are not needed any more.","created_at":"2016-03-07T20:47:31Z","updated_at":"2016-03-07T20:47:31Z","html_url":"https://github.com/apache/storm/pull/1185#discussion_r55269210","pull_request_url":"https://api.github.com/repos/apache/storm/pulls/1185","_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/comments/55269210"},"html":{"href":"https://github.com/apache/storm/pull/1185#discussion_r55269210"},"pull_request":{"href":"https://api.github.com/repos/apache/storm/pulls/1185"}}},"pull_request":{"url":"https://api.github.com/repos/apache/storm/pulls/1185","id":61679504,"html_url":"https://github.com/apache/storm/pull/1185","diff_url":"https://github.com/apache/storm/pull/1185.diff","patch_url":"https://github.com/apache/storm/pull/1185.patch","issue_url":"https://api.github.com/repos/apache/storm/issues/1185","number":1185,"state":"open","locked":false,"title":"[STORM-1269] port backtype.storm.daemon.common to java","user":{"login":"bastiliu","id":7921256,"avatar_url":"https://avatars.githubusercontent.com/u/7921256?v=3","gravatar_id":"","url":"https://api.github.com/users/bastiliu","html_url":"https://github.com/bastiliu","followers_url":"https://api.github.com/users/bastiliu/followers","following_url":"https://api.github.com/users/bastiliu/following{/other_user}","gists_url":"https://api.github.com/users/bastiliu/gists{/gist_id}","starred_url":"https://api.github.com/users/bastiliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastiliu/subscriptions","organizations_url":"https://api.github.com/users/bastiliu/orgs","repos_url":"https://api.github.com/users/bastiliu/repos","events_url":"https://api.github.com/users/bastiliu/events{/privacy}","received_events_url":"https://api.github.com/users/bastiliu/received_events","type":"User","site_admin":false},"body":"1. Following clojure defined records in common, \"Assignment, StormBase, SupervisorInfo, ExecutorStats\", were not migrated here. There are corresponding classes of Thrift. So, we can just use the thrift class in the dependency modules after each module's migration.\r\n2. worker-context was not migrated. There is much more worker to convert the worker data between java and clojure now. But it is easy to do this after the worker data is migrated to java. So I recommend to leave the mirgation of worker context as a part of  worker module.","created_at":"2016-03-04T08:11:40Z","updated_at":"2016-03-07T20:47:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f1687b8d21c95d63e49826c98df8af28c8d95ab","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/storm/pulls/1185/commits","review_comments_url":"https://api.github.com/repos/apache/storm/pulls/1185/comments","review_comment_url":"https://api.github.com/repos/apache/storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/storm/issues/1185/comments","statuses_url":"https://api.github.com/repos/apache/storm/statuses/eca27bc435a7002375a9f8682174afbacf69fc89","head":{"label":"bastiliu:master","ref":"master","sha":"eca27bc435a7002375a9f8682174afbacf69fc89","user":{"login":"bastiliu","id":7921256,"avatar_url":"https://avatars.githubusercontent.com/u/7921256?v=3","gravatar_id":"","url":"https://api.github.com/users/bastiliu","html_url":"https://github.com/bastiliu","followers_url":"https://api.github.com/users/bastiliu/followers","following_url":"https://api.github.com/users/bastiliu/following{/other_user}","gists_url":"https://api.github.com/users/bastiliu/gists{/gist_id}","starred_url":"https://api.github.com/users/bastiliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastiliu/subscriptions","organizations_url":"https://api.github.com/users/bastiliu/orgs","repos_url":"https://api.github.com/users/bastiliu/repos","events_url":"https://api.github.com/users/bastiliu/events{/privacy}","received_events_url":"https://api.github.com/users/bastiliu/received_events","type":"User","site_admin":false},"repo":{"id":46766287,"name":"storm","full_name":"bastiliu/storm","owner":{"login":"bastiliu","id":7921256,"avatar_url":"https://avatars.githubusercontent.com/u/7921256?v=3","gravatar_id":"","url":"https://api.github.com/users/bastiliu","html_url":"https://github.com/bastiliu","followers_url":"https://api.github.com/users/bastiliu/followers","following_url":"https://api.github.com/users/bastiliu/following{/other_user}","gists_url":"https://api.github.com/users/bastiliu/gists{/gist_id}","starred_url":"https://api.github.com/users/bastiliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bastiliu/subscriptions","organizations_url":"https://api.github.com/users/bastiliu/orgs","repos_url":"https://api.github.com/users/bastiliu/repos","events_url":"https://api.github.com/users/bastiliu/events{/privacy}","received_events_url":"https://api.github.com/users/bastiliu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bastiliu/storm","description":"Mirror of Apache Storm","fork":true,"url":"https://api.github.com/repos/bastiliu/storm","forks_url":"https://api.github.com/repos/bastiliu/storm/forks","keys_url":"https://api.github.com/repos/bastiliu/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bastiliu/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bastiliu/storm/teams","hooks_url":"https://api.github.com/repos/bastiliu/storm/hooks","issue_events_url":"https://api.github.com/repos/bastiliu/storm/issues/events{/number}","events_url":"https://api.github.com/repos/bastiliu/storm/events","assignees_url":"https://api.github.com/repos/bastiliu/storm/assignees{/user}","branches_url":"https://api.github.com/repos/bastiliu/storm/branches{/branch}","tags_url":"https://api.github.com/repos/bastiliu/storm/tags","blobs_url":"https://api.github.com/repos/bastiliu/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bastiliu/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bastiliu/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/bastiliu/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bastiliu/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/bastiliu/storm/languages","stargazers_url":"https://api.github.com/repos/bastiliu/storm/stargazers","contributors_url":"https://api.github.com/repos/bastiliu/storm/contributors","subscribers_url":"https://api.github.com/repos/bastiliu/storm/subscribers","subscription_url":"https://api.github.com/repos/bastiliu/storm/subscription","commits_url":"https://api.github.com/repos/bastiliu/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/bastiliu/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/bastiliu/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/bastiliu/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/bastiliu/storm/contents/{+path}","compare_url":"https://api.github.com/repos/bastiliu/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bastiliu/storm/merges","archive_url":"https://api.github.com/repos/bastiliu/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bastiliu/storm/downloads","issues_url":"https://api.github.com/repos/bastiliu/storm/issues{/number}","pulls_url":"https://api.github.com/repos/bastiliu/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/bastiliu/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/bastiliu/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bastiliu/storm/labels{/name}","releases_url":"https://api.github.com/repos/bastiliu/storm/releases{/id}","deployments_url":"https://api.github.com/repos/bastiliu/storm/deployments","created_at":"2015-11-24T04:12:48Z","updated_at":"2016-02-01T03:19:49Z","pushed_at":"2016-03-04T09:26:13Z","git_url":"git://github.com/bastiliu/storm.git","ssh_url":"git@github.com:bastiliu/storm.git","clone_url":"https://github.com/bastiliu/storm.git","svn_url":"https://github.com/bastiliu/storm","homepage":null,"size":153739,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"672c8951bbee8348a4c686511e4f3f84c00d8385","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":14135470,"name":"storm","full_name":"apache/storm","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/storm","description":"Mirror of Apache Storm","fork":false,"url":"https://api.github.com/repos/apache/storm","forks_url":"https://api.github.com/repos/apache/storm/forks","keys_url":"https://api.github.com/repos/apache/storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/storm/teams","hooks_url":"https://api.github.com/repos/apache/storm/hooks","issue_events_url":"https://api.github.com/repos/apache/storm/issues/events{/number}","events_url":"https://api.github.com/repos/apache/storm/events","assignees_url":"https://api.github.com/repos/apache/storm/assignees{/user}","branches_url":"https://api.github.com/repos/apache/storm/branches{/branch}","tags_url":"https://api.github.com/repos/apache/storm/tags","blobs_url":"https://api.github.com/repos/apache/storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/storm/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/storm/languages","stargazers_url":"https://api.github.com/repos/apache/storm/stargazers","contributors_url":"https://api.github.com/repos/apache/storm/contributors","subscribers_url":"https://api.github.com/repos/apache/storm/subscribers","subscription_url":"https://api.github.com/repos/apache/storm/subscription","commits_url":"https://api.github.com/repos/apache/storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/storm/contents/{+path}","compare_url":"https://api.github.com/repos/apache/storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/storm/merges","archive_url":"https://api.github.com/repos/apache/storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/storm/downloads","issues_url":"https://api.github.com/repos/apache/storm/issues{/number}","pulls_url":"https://api.github.com/repos/apache/storm/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/storm/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/storm/labels{/name}","releases_url":"https://api.github.com/repos/apache/storm/releases{/id}","deployments_url":"https://api.github.com/repos/apache/storm/deployments","created_at":"2013-11-05T08:00:14Z","updated_at":"2016-03-07T14:59:51Z","pushed_at":"2016-03-07T20:47:22Z","git_url":"git://github.com/apache/storm.git","ssh_url":"git@github.com:apache/storm.git","clone_url":"https://github.com/apache/storm.git","svn_url":"https://github.com/apache/storm","homepage":null,"size":158890,"stargazers_count":2920,"watchers_count":2920,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2185,"mirror_url":"git://git.apache.org/storm.git","open_issues_count":94,"forks":2185,"open_issues":94,"watchers":2920,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/storm/pulls/1185"},"html":{"href":"https://github.com/apache/storm/pull/1185"},"issue":{"href":"https://api.github.com/repos/apache/storm/issues/1185"},"comments":{"href":"https://api.github.com/repos/apache/storm/issues/1185/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/storm/pulls/1185/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/storm/pulls/1185/commits"},"statuses":{"href":"https://api.github.com/repos/apache/storm/statuses/eca27bc435a7002375a9f8682174afbacf69fc89"}}}}