{"action":"created","comment":{"url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/comments/58637624","id":58637624,"diff_hunk":"@@ -0,0 +1,79 @@\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,\n+// software distributed under the License is distributed on an\n+// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+// KIND, either express or implied.  See the License for the\n+// specific language governing permissions and limitations\n+// under the License.\n+\n+using System;\n+using Microsoft.Practices.TransientFaultHandling;\n+using Org.Apache.REEF.Tang.Annotations;\n+using Org.Apache.REEF.Utilities.Logging;\n+using Org.Apache.REEF.Wake.Remote.Parameters;\n+\n+namespace Org.Apache.REEF.Wake.Remote.Impl\n+{\n+    /// <summary>\n+    /// Handles the retry logic to connect to remote endpoint\n+    /// </summary>\n+    internal class RemoteConnectionRetryHandler : IConnectionRetryHandler\n+    {\n+        private static readonly Logger Logger = Logger.GetLogger(typeof(RemoteConnectionRetryHandler));\n+        private readonly int _retryCount;\n+        private readonly TimeSpan _timeIntervalInMs;\n+        private RetryPolicy<AllErrorsTransientStrategy> _retryPolicy;\n+\n+        /// <summary>\n+        /// Constructor\n+        /// </summary>\n+        /// <param name=\"retryCount\">Number of times to retry connection</param>\n+        /// <param name=\"timeIntervalInMs\">Time interval between retries in milli seconds</param>\n+        [Inject]\n+        internal RemoteConnectionRetryHandler([Parameter(typeof(ConnectionRetryCount))] int retryCount,\n+            [Parameter(typeof(SleepTimeInMs))] int timeIntervalInMs)\n+        {\n+            _retryCount = retryCount;\n+            _timeIntervalInMs = TimeSpan.FromMilliseconds(timeIntervalInMs);\n+            _retryPolicy = new RetryPolicy<AllErrorsTransientStrategy>(\n+                    new FixedInterval(\"ConnectionRetries\", _retryCount, _timeIntervalInMs, true));\n+            _retryPolicy.Retrying += (sender, args) =>","path":"lang/cs/Org.Apache.REEF.Wake/Remote/Impl/RemoteConnectionRetryHandler.cs","position":49,"original_position":49,"commit_id":"d4aea4f3c684c58fa093a868d66b02506be7eada","original_commit_id":"d4aea4f3c684c58fa093a868d66b02506be7eada","user":{"login":"markusweimer","id":502371,"avatar_url":"https://avatars.githubusercontent.com/u/502371?v=3","gravatar_id":"","url":"https://api.github.com/users/markusweimer","html_url":"https://github.com/markusweimer","followers_url":"https://api.github.com/users/markusweimer/followers","following_url":"https://api.github.com/users/markusweimer/following{/other_user}","gists_url":"https://api.github.com/users/markusweimer/gists{/gist_id}","starred_url":"https://api.github.com/users/markusweimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markusweimer/subscriptions","organizations_url":"https://api.github.com/users/markusweimer/orgs","repos_url":"https://api.github.com/users/markusweimer/repos","events_url":"https://api.github.com/users/markusweimer/events{/privacy}","received_events_url":"https://api.github.com/users/markusweimer/received_events","type":"User","site_admin":false},"body":"You could have a unit test where you fake the remote end of the connection and make sure that the right number of retries is done and that it gives up after the right number of retries.","created_at":"2016-04-06T00:46:37Z","updated_at":"2016-04-06T00:46:37Z","html_url":"https://github.com/dkm2110/Microsoft-cisl/pull/1#discussion_r58637624","pull_request_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/comments/58637624"},"html":{"href":"https://github.com/dkm2110/Microsoft-cisl/pull/1#discussion_r58637624"},"pull_request":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1","id":64560053,"html_url":"https://github.com/dkm2110/Microsoft-cisl/pull/1","diff_url":"https://github.com/dkm2110/Microsoft-cisl/pull/1.diff","patch_url":"https://github.com/dkm2110/Microsoft-cisl/pull/1.patch","issue_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/1","number":1,"state":"open","locked":false,"title":"[REEF-1292] Link and StreamingLink classes should have retry logic for setting up remote connection","user":{"login":"dkm2110","id":151031,"avatar_url":"https://avatars.githubusercontent.com/u/151031?v=3","gravatar_id":"","url":"https://api.github.com/users/dkm2110","html_url":"https://github.com/dkm2110","followers_url":"https://api.github.com/users/dkm2110/followers","following_url":"https://api.github.com/users/dkm2110/following{/other_user}","gists_url":"https://api.github.com/users/dkm2110/gists{/gist_id}","starred_url":"https://api.github.com/users/dkm2110/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkm2110/subscriptions","organizations_url":"https://api.github.com/users/dkm2110/orgs","repos_url":"https://api.github.com/users/dkm2110/repos","events_url":"https://api.github.com/users/dkm2110/events{/privacy}","received_events_url":"https://api.github.com/users/dkm2110/received_events","type":"User","site_admin":false},"body":"This addressed the issue by\r\n  * introducing RemoteConnectionRetryHandler that handles the retry logic for connecting to remote endpoint\r\n  * allowing user to specify the value of connection retries and sleep times bewteen retries for NameClient, DefaultRemoteManagerFactory and StreamingRemoteManagerFactory.\r\n\r\nJIRA:\r\n  [REEF-1292](https://issues.apache.org/jira/browse/REEF-1292)","created_at":"2016-03-30T01:37:56Z","updated_at":"2016-04-06T00:46:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ff8c1f40b54c363b8e9938ca200e3e87ac05f85","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1/commits","review_comments_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1/comments","review_comment_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/1/comments","statuses_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/statuses/d4aea4f3c684c58fa093a868d66b02506be7eada","head":{"label":"dkm2110:REEF-1292","ref":"REEF-1292","sha":"d4aea4f3c684c58fa093a868d66b02506be7eada","user":{"login":"dkm2110","id":151031,"avatar_url":"https://avatars.githubusercontent.com/u/151031?v=3","gravatar_id":"","url":"https://api.github.com/users/dkm2110","html_url":"https://github.com/dkm2110","followers_url":"https://api.github.com/users/dkm2110/followers","following_url":"https://api.github.com/users/dkm2110/following{/other_user}","gists_url":"https://api.github.com/users/dkm2110/gists{/gist_id}","starred_url":"https://api.github.com/users/dkm2110/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkm2110/subscriptions","organizations_url":"https://api.github.com/users/dkm2110/orgs","repos_url":"https://api.github.com/users/dkm2110/repos","events_url":"https://api.github.com/users/dkm2110/events{/privacy}","received_events_url":"https://api.github.com/users/dkm2110/received_events","type":"User","site_admin":false},"repo":{"id":8815191,"name":"Microsoft-cisl","full_name":"dkm2110/Microsoft-cisl","owner":{"login":"dkm2110","id":151031,"avatar_url":"https://avatars.githubusercontent.com/u/151031?v=3","gravatar_id":"","url":"https://api.github.com/users/dkm2110","html_url":"https://github.com/dkm2110","followers_url":"https://api.github.com/users/dkm2110/followers","following_url":"https://api.github.com/users/dkm2110/following{/other_user}","gists_url":"https://api.github.com/users/dkm2110/gists{/gist_id}","starred_url":"https://api.github.com/users/dkm2110/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkm2110/subscriptions","organizations_url":"https://api.github.com/users/dkm2110/orgs","repos_url":"https://api.github.com/users/dkm2110/repos","events_url":"https://api.github.com/users/dkm2110/events{/privacy}","received_events_url":"https://api.github.com/users/dkm2110/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dkm2110/Microsoft-cisl","description":null,"fork":false,"url":"https://api.github.com/repos/dkm2110/Microsoft-cisl","forks_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/forks","keys_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/teams","hooks_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/hooks","issue_events_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/events{/number}","events_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/events","assignees_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/assignees{/user}","branches_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/branches{/branch}","tags_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/tags","blobs_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/statuses/{sha}","languages_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/languages","stargazers_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/stargazers","contributors_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/contributors","subscribers_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/subscribers","subscription_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/subscription","commits_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/comments{/number}","contents_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/contents/{+path}","compare_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/merges","archive_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/downloads","issues_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues{/number}","pulls_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls{/number}","milestones_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/milestones{/number}","notifications_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/labels{/name}","releases_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/releases{/id}","deployments_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/deployments","created_at":"2013-03-16T06:39:59Z","updated_at":"2016-03-30T01:03:34Z","pushed_at":"2016-04-05T23:28:19Z","git_url":"git://github.com/dkm2110/Microsoft-cisl.git","ssh_url":"git@github.com:dkm2110/Microsoft-cisl.git","clone_url":"https://github.com/dkm2110/Microsoft-cisl.git","svn_url":"https://github.com/dkm2110/Microsoft-cisl","homepage":null,"size":27949,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"dkm2110:master","ref":"master","sha":"e0c0d6a49acaa101ea49cb7c728a3ee23993d467","user":{"login":"dkm2110","id":151031,"avatar_url":"https://avatars.githubusercontent.com/u/151031?v=3","gravatar_id":"","url":"https://api.github.com/users/dkm2110","html_url":"https://github.com/dkm2110","followers_url":"https://api.github.com/users/dkm2110/followers","following_url":"https://api.github.com/users/dkm2110/following{/other_user}","gists_url":"https://api.github.com/users/dkm2110/gists{/gist_id}","starred_url":"https://api.github.com/users/dkm2110/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkm2110/subscriptions","organizations_url":"https://api.github.com/users/dkm2110/orgs","repos_url":"https://api.github.com/users/dkm2110/repos","events_url":"https://api.github.com/users/dkm2110/events{/privacy}","received_events_url":"https://api.github.com/users/dkm2110/received_events","type":"User","site_admin":false},"repo":{"id":8815191,"name":"Microsoft-cisl","full_name":"dkm2110/Microsoft-cisl","owner":{"login":"dkm2110","id":151031,"avatar_url":"https://avatars.githubusercontent.com/u/151031?v=3","gravatar_id":"","url":"https://api.github.com/users/dkm2110","html_url":"https://github.com/dkm2110","followers_url":"https://api.github.com/users/dkm2110/followers","following_url":"https://api.github.com/users/dkm2110/following{/other_user}","gists_url":"https://api.github.com/users/dkm2110/gists{/gist_id}","starred_url":"https://api.github.com/users/dkm2110/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkm2110/subscriptions","organizations_url":"https://api.github.com/users/dkm2110/orgs","repos_url":"https://api.github.com/users/dkm2110/repos","events_url":"https://api.github.com/users/dkm2110/events{/privacy}","received_events_url":"https://api.github.com/users/dkm2110/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dkm2110/Microsoft-cisl","description":null,"fork":false,"url":"https://api.github.com/repos/dkm2110/Microsoft-cisl","forks_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/forks","keys_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/teams","hooks_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/hooks","issue_events_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/events{/number}","events_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/events","assignees_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/assignees{/user}","branches_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/branches{/branch}","tags_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/tags","blobs_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/refs{/sha}","trees_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/statuses/{sha}","languages_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/languages","stargazers_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/stargazers","contributors_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/contributors","subscribers_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/subscribers","subscription_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/subscription","commits_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/commits{/sha}","git_commits_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/git/commits{/sha}","comments_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/comments{/number}","issue_comment_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/comments{/number}","contents_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/contents/{+path}","compare_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/merges","archive_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/downloads","issues_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues{/number}","pulls_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls{/number}","milestones_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/milestones{/number}","notifications_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/labels{/name}","releases_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/releases{/id}","deployments_url":"https://api.github.com/repos/dkm2110/Microsoft-cisl/deployments","created_at":"2013-03-16T06:39:59Z","updated_at":"2016-03-30T01:03:34Z","pushed_at":"2016-04-05T23:28:19Z","git_url":"git://github.com/dkm2110/Microsoft-cisl.git","ssh_url":"git@github.com:dkm2110/Microsoft-cisl.git","clone_url":"https://github.com/dkm2110/Microsoft-cisl.git","svn_url":"https://github.com/dkm2110/Microsoft-cisl","homepage":null,"size":27949,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1"},"html":{"href":"https://github.com/dkm2110/Microsoft-cisl/pull/1"},"issue":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/1"},"comments":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/dkm2110/Microsoft-cisl/statuses/d4aea4f3c684c58fa093a868d66b02506be7eada"}}}}