{"action":"created","comment":{"url":"https://api.github.com/repos/apache/hadoop/pulls/comments/87849676","pull_request_review_id":8444244,"id":87849676,"diff_hunk":"@@ -0,0 +1,190 @@\n+/**\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with this\n+ * work for additional information regarding copyright ownership.  The ASF\n+ * licenses this file to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ * <p>\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ * <p>\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations under\n+ * the License.\n+ */\n+package org.apache.hadoop.ozone.container.common;\n+\n+import com.google.protobuf.BlockingService;\n+import org.apache.hadoop.conf.Configuration;\n+import org.apache.hadoop.hdfs.DFSUtil;\n+import org.apache.hadoop.hdfs.protocol.DatanodeID;\n+import org.apache.hadoop.io.retry.RetryPolicies;\n+import org.apache.hadoop.ipc.ProtobufRpcEngine;\n+import org.apache.hadoop.ipc.RPC;\n+import org.apache.hadoop.net.NetUtils;\n+import org.apache.hadoop.ozone.container.common.statemachine.EndpointStateMachine;\n+import org.apache.hadoop.ozone.protocol.StorageContainerDatanodeProtocol;\n+import org.apache.hadoop.ozone.protocol.commands.RegisteredCommand;\n+import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageContainerDatanodeProtocolService;\n+import org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolClientSideTranslatorPB;\n+import org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolPB;\n+import org.apache.hadoop.ozone.protocolPB.StorageContainerDatanodeProtocolServerSideTranslatorPB;\n+import org.apache.hadoop.ozone.scm.node.SCMNodeManager;\n+import org.apache.hadoop.security.UserGroupInformation;\n+\n+import java.io.IOException;\n+import java.net.InetAddress;\n+import java.net.InetSocketAddress;\n+import java.net.ServerSocket;\n+import java.util.Random;\n+import java.util.UUID;\n+\n+/**\n+ * Test Endpoint class.\n+ */\n+public final class SCMTestUtils {\n+  /**\n+   * Never constructed.\n+   */\n+  private SCMTestUtils() {\n+  }\n+\n+  /**\n+   * Starts an RPC server, if configured.\n+   *\n+   * @param conf configuration\n+   * @param addr configured address of RPC server\n+   * @param protocol RPC protocol provided by RPC server\n+   * @param instance RPC protocol implementation instance\n+   * @param handlerCount RPC server handler count\n+   * @return RPC server\n+   * @throws IOException if there is an I/O error while creating RPC server\n+   */\n+  private static RPC.Server startRpcServer(Configuration conf,\n+      InetSocketAddress addr, Class<?>\n+      protocol, BlockingService instance, int handlerCount)\n+      throws IOException {\n+    RPC.Server rpcServer = new RPC.Builder(conf)\n+        .setProtocol(protocol)\n+        .setInstance(instance)\n+        .setBindAddress(addr.getHostString())\n+        .setPort(addr.getPort())\n+        .setNumHandlers(handlerCount)\n+        .setVerbose(false)\n+        .setSecretManager(null)\n+        .build();\n+\n+    DFSUtil.addPBProtocol(conf, protocol, instance, rpcServer);\n+    return rpcServer;\n+  }\n+\n+  /**\n+   * Creates an Endpoint class for testing purpose.\n+   *\n+   * @param conf - Conf\n+   * @param address - InetAddres\n+   * @param rpcTimeout - rpcTimeOut\n+   * @return EndPoint\n+   * @throws Exception\n+   */\n+  public static EndpointStateMachine createEndpoint(Configuration conf,\n+      InetSocketAddress\n+          address,","path":"hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/container/common/SCMTestUtils.java","position":94,"original_position":94,"commit_id":"ef7262f58b81e1055ebe6874fb521eb8c16078aa","original_commit_id":"ef7262f58b81e1055ebe6874fb521eb8c16078aa","user":{"login":"xiaoyuyao","id":7039184,"avatar_url":"https://avatars.githubusercontent.com/u/7039184?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaoyuyao","html_url":"https://github.com/xiaoyuyao","followers_url":"https://api.github.com/users/xiaoyuyao/followers","following_url":"https://api.github.com/users/xiaoyuyao/following{/other_user}","gists_url":"https://api.github.com/users/xiaoyuyao/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaoyuyao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaoyuyao/subscriptions","organizations_url":"https://api.github.com/users/xiaoyuyao/orgs","repos_url":"https://api.github.com/users/xiaoyuyao/repos","events_url":"https://api.github.com/users/xiaoyuyao/events{/privacy}","received_events_url":"https://api.github.com/users/xiaoyuyao/received_events","type":"User","site_admin":false},"body":"NIT: formatting: address can be moved to the line above with its type.","created_at":"2016-11-14T17:27:26Z","updated_at":"2016-11-14T17:27:26Z","html_url":"https://github.com/apache/hadoop/pull/151#discussion_r87849676","pull_request_url":"https://api.github.com/repos/apache/hadoop/pulls/151","_links":{"self":{"href":"https://api.github.com/repos/apache/hadoop/pulls/comments/87849676"},"html":{"href":"https://github.com/apache/hadoop/pull/151#discussion_r87849676"},"pull_request":{"href":"https://api.github.com/repos/apache/hadoop/pulls/151"}}},"pull_request":{"url":"https://api.github.com/repos/apache/hadoop/pulls/151","id":92256789,"html_url":"https://github.com/apache/hadoop/pull/151","diff_url":"https://github.com/apache/hadoop/pull/151.diff","patch_url":"https://github.com/apache/hadoop/pull/151.patch","issue_url":"https://api.github.com/repos/apache/hadoop/issues/151","number":151,"state":"open","locked":false,"title":"Ozone:SCM: Add support for registerNode in datanode","user":{"login":"anuengineer","id":2831777,"avatar_url":"https://avatars.githubusercontent.com/u/2831777?v=3","gravatar_id":"","url":"https://api.github.com/users/anuengineer","html_url":"https://github.com/anuengineer","followers_url":"https://api.github.com/users/anuengineer/followers","following_url":"https://api.github.com/users/anuengineer/following{/other_user}","gists_url":"https://api.github.com/users/anuengineer/gists{/gist_id}","starred_url":"https://api.github.com/users/anuengineer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anuengineer/subscriptions","organizations_url":"https://api.github.com/users/anuengineer/orgs","repos_url":"https://api.github.com/users/anuengineer/repos","events_url":"https://api.github.com/users/anuengineer/events{/privacy}","received_events_url":"https://api.github.com/users/anuengineer/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-03T22:59:56Z","updated_at":"2016-11-14T17:27:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d552f787ad054bf6d57cb93c64c8253e3a376306","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/hadoop/pulls/151/commits","review_comments_url":"https://api.github.com/repos/apache/hadoop/pulls/151/comments","review_comment_url":"https://api.github.com/repos/apache/hadoop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/hadoop/issues/151/comments","statuses_url":"https://api.github.com/repos/apache/hadoop/statuses/ef7262f58b81e1055ebe6874fb521eb8c16078aa","head":{"label":"anuengineer:HDFS-7240","ref":"HDFS-7240","sha":"ef7262f58b81e1055ebe6874fb521eb8c16078aa","user":{"login":"anuengineer","id":2831777,"avatar_url":"https://avatars.githubusercontent.com/u/2831777?v=3","gravatar_id":"","url":"https://api.github.com/users/anuengineer","html_url":"https://github.com/anuengineer","followers_url":"https://api.github.com/users/anuengineer/followers","following_url":"https://api.github.com/users/anuengineer/following{/other_user}","gists_url":"https://api.github.com/users/anuengineer/gists{/gist_id}","starred_url":"https://api.github.com/users/anuengineer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anuengineer/subscriptions","organizations_url":"https://api.github.com/users/anuengineer/orgs","repos_url":"https://api.github.com/users/anuengineer/repos","events_url":"https://api.github.com/users/anuengineer/events{/privacy}","received_events_url":"https://api.github.com/users/anuengineer/received_events","type":"User","site_admin":false},"repo":{"id":72793201,"name":"hadoop-1","full_name":"anuengineer/hadoop-1","owner":{"login":"anuengineer","id":2831777,"avatar_url":"https://avatars.githubusercontent.com/u/2831777?v=3","gravatar_id":"","url":"https://api.github.com/users/anuengineer","html_url":"https://github.com/anuengineer","followers_url":"https://api.github.com/users/anuengineer/followers","following_url":"https://api.github.com/users/anuengineer/following{/other_user}","gists_url":"https://api.github.com/users/anuengineer/gists{/gist_id}","starred_url":"https://api.github.com/users/anuengineer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anuengineer/subscriptions","organizations_url":"https://api.github.com/users/anuengineer/orgs","repos_url":"https://api.github.com/users/anuengineer/repos","events_url":"https://api.github.com/users/anuengineer/events{/privacy}","received_events_url":"https://api.github.com/users/anuengineer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/anuengineer/hadoop-1","description":"Mirror of Apache Hadoop","fork":true,"url":"https://api.github.com/repos/anuengineer/hadoop-1","forks_url":"https://api.github.com/repos/anuengineer/hadoop-1/forks","keys_url":"https://api.github.com/repos/anuengineer/hadoop-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/anuengineer/hadoop-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/anuengineer/hadoop-1/teams","hooks_url":"https://api.github.com/repos/anuengineer/hadoop-1/hooks","issue_events_url":"https://api.github.com/repos/anuengineer/hadoop-1/issues/events{/number}","events_url":"https://api.github.com/repos/anuengineer/hadoop-1/events","assignees_url":"https://api.github.com/repos/anuengineer/hadoop-1/assignees{/user}","branches_url":"https://api.github.com/repos/anuengineer/hadoop-1/branches{/branch}","tags_url":"https://api.github.com/repos/anuengineer/hadoop-1/tags","blobs_url":"https://api.github.com/repos/anuengineer/hadoop-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/anuengineer/hadoop-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/anuengineer/hadoop-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/anuengineer/hadoop-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/anuengineer/hadoop-1/statuses/{sha}","languages_url":"https://api.github.com/repos/anuengineer/hadoop-1/languages","stargazers_url":"https://api.github.com/repos/anuengineer/hadoop-1/stargazers","contributors_url":"https://api.github.com/repos/anuengineer/hadoop-1/contributors","subscribers_url":"https://api.github.com/repos/anuengineer/hadoop-1/subscribers","subscription_url":"https://api.github.com/repos/anuengineer/hadoop-1/subscription","commits_url":"https://api.github.com/repos/anuengineer/hadoop-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/anuengineer/hadoop-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/anuengineer/hadoop-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/anuengineer/hadoop-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/anuengineer/hadoop-1/contents/{+path}","compare_url":"https://api.github.com/repos/anuengineer/hadoop-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/anuengineer/hadoop-1/merges","archive_url":"https://api.github.com/repos/anuengineer/hadoop-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/anuengineer/hadoop-1/downloads","issues_url":"https://api.github.com/repos/anuengineer/hadoop-1/issues{/number}","pulls_url":"https://api.github.com/repos/anuengineer/hadoop-1/pulls{/number}","milestones_url":"https://api.github.com/repos/anuengineer/hadoop-1/milestones{/number}","notifications_url":"https://api.github.com/repos/anuengineer/hadoop-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/anuengineer/hadoop-1/labels{/name}","releases_url":"https://api.github.com/repos/anuengineer/hadoop-1/releases{/id}","deployments_url":"https://api.github.com/repos/anuengineer/hadoop-1/deployments","created_at":"2016-11-03T22:39:54Z","updated_at":"2016-11-03T22:40:32Z","pushed_at":"2016-11-03T22:59:09Z","git_url":"git://github.com/anuengineer/hadoop-1.git","ssh_url":"git@github.com:anuengineer/hadoop-1.git","clone_url":"https://github.com/anuengineer/hadoop-1.git","svn_url":"https://github.com/anuengineer/hadoop-1","homepage":null,"size":363695,"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":"trunk"}},"base":{"label":"apache:HDFS-7240","ref":"HDFS-7240","sha":"eb8f2b2ca0835d756132e56c854685c9c4fa4eab","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":23418517,"name":"hadoop","full_name":"apache/hadoop","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/hadoop","description":"Mirror of Apache Hadoop","fork":false,"url":"https://api.github.com/repos/apache/hadoop","forks_url":"https://api.github.com/repos/apache/hadoop/forks","keys_url":"https://api.github.com/repos/apache/hadoop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/hadoop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/hadoop/teams","hooks_url":"https://api.github.com/repos/apache/hadoop/hooks","issue_events_url":"https://api.github.com/repos/apache/hadoop/issues/events{/number}","events_url":"https://api.github.com/repos/apache/hadoop/events","assignees_url":"https://api.github.com/repos/apache/hadoop/assignees{/user}","branches_url":"https://api.github.com/repos/apache/hadoop/branches{/branch}","tags_url":"https://api.github.com/repos/apache/hadoop/tags","blobs_url":"https://api.github.com/repos/apache/hadoop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/hadoop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/hadoop/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/hadoop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/hadoop/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/hadoop/languages","stargazers_url":"https://api.github.com/repos/apache/hadoop/stargazers","contributors_url":"https://api.github.com/repos/apache/hadoop/contributors","subscribers_url":"https://api.github.com/repos/apache/hadoop/subscribers","subscription_url":"https://api.github.com/repos/apache/hadoop/subscription","commits_url":"https://api.github.com/repos/apache/hadoop/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/hadoop/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/hadoop/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/hadoop/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/hadoop/contents/{+path}","compare_url":"https://api.github.com/repos/apache/hadoop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/hadoop/merges","archive_url":"https://api.github.com/repos/apache/hadoop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/hadoop/downloads","issues_url":"https://api.github.com/repos/apache/hadoop/issues{/number}","pulls_url":"https://api.github.com/repos/apache/hadoop/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/hadoop/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/hadoop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/hadoop/labels{/name}","releases_url":"https://api.github.com/repos/apache/hadoop/releases{/id}","deployments_url":"https://api.github.com/repos/apache/hadoop/deployments","created_at":"2014-08-28T07:00:08Z","updated_at":"2016-11-14T17:00:38Z","pushed_at":"2016-11-14T16:20:26Z","git_url":"git://github.com/apache/hadoop.git","ssh_url":"git@github.com:apache/hadoop.git","clone_url":"https://github.com/apache/hadoop.git","svn_url":"https://github.com/apache/hadoop","homepage":null,"size":428872,"stargazers_count":2539,"watchers_count":2539,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2504,"mirror_url":"git://git.apache.org/hadoop.git","open_issues_count":74,"forks":2504,"open_issues":74,"watchers":2539,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/hadoop/pulls/151"},"html":{"href":"https://github.com/apache/hadoop/pull/151"},"issue":{"href":"https://api.github.com/repos/apache/hadoop/issues/151"},"comments":{"href":"https://api.github.com/repos/apache/hadoop/issues/151/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/hadoop/pulls/151/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/hadoop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/hadoop/pulls/151/commits"},"statuses":{"href":"https://api.github.com/repos/apache/hadoop/statuses/ef7262f58b81e1055ebe6874fb521eb8c16078aa"}}}}
{"actor":{"display_login":"xiaoyuyao"}}