{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/63687890","id":63687890,"diff_hunk":"@@ -0,0 +1,88 @@\n+/*\n+ * Copyright (c) 2008-2016, Hazelcast, Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * 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+\n+package com.hazelcast.partition.membergroup;\n+\n+\n+import com.hazelcast.config.InvalidConfigurationException;\n+import com.hazelcast.config.properties.ValidationException;\n+import com.hazelcast.core.Member;\n+import com.hazelcast.logging.ILogger;\n+import com.hazelcast.spi.discovery.DiscoveryStrategy;\n+import com.hazelcast.spi.discovery.DiscoveryStrategyFactory;\n+import com.hazelcast.spi.discovery.impl.DefaultDiscoveryService;\n+import com.hazelcast.spi.discovery.integration.DiscoveryService;\n+\n+import java.util.Collection;\n+import java.util.HashMap;\n+import java.util.HashSet;\n+import java.util.Set;\n+\n+import static com.hazelcast.util.Preconditions.checkNotNull;\n+\n+\n+public class SPIAwareMemberGroupFactory extends BackupSafeMemberGroupFactory implements MemberGroupFactory {\n+\n+    private final DiscoveryService discoveryService;\n+\n+    public SPIAwareMemberGroupFactory(DiscoveryService discoveryService) {\n+         this.discoveryService = discoveryService;\n+    }\n+\n+    @Override\n+    protected Set<MemberGroup> createInternalMemberGroups(Collection<? extends Member> allMembers) {\n+        Set<MemberGroup> memberGroups = new HashSet<MemberGroup>();\n+\n+        for (Member member : allMembers) {\n+            try {\n+                if (member.localMember()) {\n+                    DefaultDiscoveryService defaultDiscoveryService = (DefaultDiscoveryService) discoveryService;\n+                    // If no discovery strategy is found fail-fast\n+                    if (!defaultDiscoveryService.getDiscoveryStrategies().iterator().hasNext()) {\n+                        throw new RuntimeException(\"Failed to configure discovery strategies\");","path":"hazelcast/src/main/java/com/hazelcast/partition/membergroup/SPIAwareMemberGroupFactory.java","position":55,"original_position":55,"commit_id":"c639a7a1f5d0bcf46db37368d3bb76349ec70d01","original_commit_id":"c639a7a1f5d0bcf46db37368d3bb76349ec70d01","user":{"login":"emrahkocaman","id":2887123,"avatar_url":"https://avatars.githubusercontent.com/u/2887123?v=3","gravatar_id":"","url":"https://api.github.com/users/emrahkocaman","html_url":"https://github.com/emrahkocaman","followers_url":"https://api.github.com/users/emrahkocaman/followers","following_url":"https://api.github.com/users/emrahkocaman/following{/other_user}","gists_url":"https://api.github.com/users/emrahkocaman/gists{/gist_id}","starred_url":"https://api.github.com/users/emrahkocaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emrahkocaman/subscriptions","organizations_url":"https://api.github.com/users/emrahkocaman/orgs","repos_url":"https://api.github.com/users/emrahkocaman/repos","events_url":"https://api.github.com/users/emrahkocaman/events{/privacy}","received_events_url":"https://api.github.com/users/emrahkocaman/received_events","type":"User","site_admin":false},"body":"I'd prefer a more explanatory message ","created_at":"2016-05-18T11:42:08Z","updated_at":"2016-05-18T11:42:08Z","html_url":"https://github.com/hazelcast/hazelcast/pull/8187#discussion_r63687890","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/63687890"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/8187#discussion_r63687890"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187"}}},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187","id":70168112,"html_url":"https://github.com/hazelcast/hazelcast/pull/8187","diff_url":"https://github.com/hazelcast/hazelcast/pull/8187.diff","patch_url":"https://github.com/hazelcast/hazelcast/pull/8187.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/8187","number":8187,"state":"open","locked":false,"title":"Added more partition group strategy options.","user":{"login":"kobalski","id":3218140,"avatar_url":"https://avatars.githubusercontent.com/u/3218140?v=3","gravatar_id":"","url":"https://api.github.com/users/kobalski","html_url":"https://github.com/kobalski","followers_url":"https://api.github.com/users/kobalski/followers","following_url":"https://api.github.com/users/kobalski/following{/other_user}","gists_url":"https://api.github.com/users/kobalski/gists{/gist_id}","starred_url":"https://api.github.com/users/kobalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kobalski/subscriptions","organizations_url":"https://api.github.com/users/kobalski/orgs","repos_url":"https://api.github.com/users/kobalski/repos","events_url":"https://api.github.com/users/kobalski/events{/privacy}","received_events_url":"https://api.github.com/users/kobalski/received_events","type":"User","site_admin":false},"body":"Added `ZoneAwareMemberGroupFactory` and `SPIAwareMemberGroupFactory`.\r\n\r\n- `ZoneAwareMemberGroupFactory`  is responsible for creation of partition groups based on metadata provided by Discovery SPI.\r\n\r\n-  `SPIAwareMemberGroupFactory`. is responsible calling custom member group impl provided by\r\n `discoveryStrategy.getPartitionGroupStrategy().getMemberGroups()` method","created_at":"2016-05-16T08:59:30Z","updated_at":"2016-05-18T11:42:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8adf62f669c333743babd1ba3276c7f6639347f6","assignee":{"login":"kobalski","id":3218140,"avatar_url":"https://avatars.githubusercontent.com/u/3218140?v=3","gravatar_id":"","url":"https://api.github.com/users/kobalski","html_url":"https://github.com/kobalski","followers_url":"https://api.github.com/users/kobalski/followers","following_url":"https://api.github.com/users/kobalski/following{/other_user}","gists_url":"https://api.github.com/users/kobalski/gists{/gist_id}","starred_url":"https://api.github.com/users/kobalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kobalski/subscriptions","organizations_url":"https://api.github.com/users/kobalski/orgs","repos_url":"https://api.github.com/users/kobalski/repos","events_url":"https://api.github.com/users/kobalski/events{/privacy}","received_events_url":"https://api.github.com/users/kobalski/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/70","html_url":"https://github.com/hazelcast/hazelcast/milestones/3.7","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/70/labels","id":1346433,"number":70,"title":"3.7","description":"","creator":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars.githubusercontent.com/u/105243?v=3","gravatar_id":"","url":"https://api.github.com/users/pveentjer","html_url":"https://github.com/pveentjer","followers_url":"https://api.github.com/users/pveentjer/followers","following_url":"https://api.github.com/users/pveentjer/following{/other_user}","gists_url":"https://api.github.com/users/pveentjer/gists{/gist_id}","starred_url":"https://api.github.com/users/pveentjer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pveentjer/subscriptions","organizations_url":"https://api.github.com/users/pveentjer/orgs","repos_url":"https://api.github.com/users/pveentjer/repos","events_url":"https://api.github.com/users/pveentjer/events{/privacy}","received_events_url":"https://api.github.com/users/pveentjer/received_events","type":"User","site_admin":false},"open_issues":183,"closed_issues":533,"state":"open","created_at":"2015-10-09T12:16:13Z","updated_at":"2016-05-18T11:20:24Z","due_on":"2016-06-19T21:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/8187/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/c639a7a1f5d0bcf46db37368d3bb76349ec70d01","head":{"label":"kobalski:feature/master/more_partition_group_strategy","ref":"feature/master/more_partition_group_strategy","sha":"c639a7a1f5d0bcf46db37368d3bb76349ec70d01","user":{"login":"kobalski","id":3218140,"avatar_url":"https://avatars.githubusercontent.com/u/3218140?v=3","gravatar_id":"","url":"https://api.github.com/users/kobalski","html_url":"https://github.com/kobalski","followers_url":"https://api.github.com/users/kobalski/followers","following_url":"https://api.github.com/users/kobalski/following{/other_user}","gists_url":"https://api.github.com/users/kobalski/gists{/gist_id}","starred_url":"https://api.github.com/users/kobalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kobalski/subscriptions","organizations_url":"https://api.github.com/users/kobalski/orgs","repos_url":"https://api.github.com/users/kobalski/repos","events_url":"https://api.github.com/users/kobalski/events{/privacy}","received_events_url":"https://api.github.com/users/kobalski/received_events","type":"User","site_admin":false},"repo":{"id":34377800,"name":"hazelcast","full_name":"kobalski/hazelcast","owner":{"login":"kobalski","id":3218140,"avatar_url":"https://avatars.githubusercontent.com/u/3218140?v=3","gravatar_id":"","url":"https://api.github.com/users/kobalski","html_url":"https://github.com/kobalski","followers_url":"https://api.github.com/users/kobalski/followers","following_url":"https://api.github.com/users/kobalski/following{/other_user}","gists_url":"https://api.github.com/users/kobalski/gists{/gist_id}","starred_url":"https://api.github.com/users/kobalski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kobalski/subscriptions","organizations_url":"https://api.github.com/users/kobalski/orgs","repos_url":"https://api.github.com/users/kobalski/repos","events_url":"https://api.github.com/users/kobalski/events{/privacy}","received_events_url":"https://api.github.com/users/kobalski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kobalski/hazelcast","description":"Open Source In-Memory Data Grid","fork":true,"url":"https://api.github.com/repos/kobalski/hazelcast","forks_url":"https://api.github.com/repos/kobalski/hazelcast/forks","keys_url":"https://api.github.com/repos/kobalski/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kobalski/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kobalski/hazelcast/teams","hooks_url":"https://api.github.com/repos/kobalski/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/kobalski/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/kobalski/hazelcast/events","assignees_url":"https://api.github.com/repos/kobalski/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/kobalski/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/kobalski/hazelcast/tags","blobs_url":"https://api.github.com/repos/kobalski/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kobalski/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kobalski/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/kobalski/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kobalski/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/kobalski/hazelcast/languages","stargazers_url":"https://api.github.com/repos/kobalski/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/kobalski/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/kobalski/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/kobalski/hazelcast/subscription","commits_url":"https://api.github.com/repos/kobalski/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/kobalski/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/kobalski/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/kobalski/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/kobalski/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/kobalski/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kobalski/hazelcast/merges","archive_url":"https://api.github.com/repos/kobalski/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kobalski/hazelcast/downloads","issues_url":"https://api.github.com/repos/kobalski/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/kobalski/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/kobalski/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/kobalski/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kobalski/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/kobalski/hazelcast/releases{/id}","deployments_url":"https://api.github.com/repos/kobalski/hazelcast/deployments","created_at":"2015-04-22T08:14:56Z","updated_at":"2015-05-04T12:54:38Z","pushed_at":"2016-05-18T08:19:09Z","git_url":"git://github.com/kobalski/hazelcast.git","ssh_url":"git@github.com:kobalski/hazelcast.git","clone_url":"https://github.com/kobalski/hazelcast.git","svn_url":"https://github.com/kobalski/hazelcast","homepage":"www.hazelcast.com","size":92478,"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":"hazelcast:master","ref":"master","sha":"8a898fd0973b8a3dddec2ab806ab711ed0d22abd","user":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"repo":{"id":3786237,"name":"hazelcast","full_name":"hazelcast/hazelcast","owner":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hazelcast/hazelcast","description":"Open Source In-Memory Data Grid","fork":false,"url":"https://api.github.com/repos/hazelcast/hazelcast","forks_url":"https://api.github.com/repos/hazelcast/hazelcast/forks","keys_url":"https://api.github.com/repos/hazelcast/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hazelcast/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hazelcast/hazelcast/teams","hooks_url":"https://api.github.com/repos/hazelcast/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/hazelcast/hazelcast/events","assignees_url":"https://api.github.com/repos/hazelcast/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/hazelcast/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/hazelcast/hazelcast/tags","blobs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hazelcast/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/hazelcast/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/hazelcast/hazelcast/languages","stargazers_url":"https://api.github.com/repos/hazelcast/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/hazelcast/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/hazelcast/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/hazelcast/hazelcast/subscription","commits_url":"https://api.github.com/repos/hazelcast/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/hazelcast/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/hazelcast/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/hazelcast/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hazelcast/hazelcast/merges","archive_url":"https://api.github.com/repos/hazelcast/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hazelcast/hazelcast/downloads","issues_url":"https://api.github.com/repos/hazelcast/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/hazelcast/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/hazelcast/hazelcast/releases{/id}","deployments_url":"https://api.github.com/repos/hazelcast/hazelcast/deployments","created_at":"2012-03-21T12:25:18Z","updated_at":"2016-05-17T21:48:04Z","pushed_at":"2016-05-18T11:41:05Z","git_url":"git://github.com/hazelcast/hazelcast.git","ssh_url":"git@github.com:hazelcast/hazelcast.git","clone_url":"https://github.com/hazelcast/hazelcast.git","svn_url":"https://github.com/hazelcast/hazelcast","homepage":"www.hazelcast.com","size":126950,"stargazers_count":1574,"watchers_count":1574,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":740,"mirror_url":null,"open_issues_count":592,"forks":740,"open_issues":592,"watchers":1574,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/8187"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/8187"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/8187/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/8187/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast/statuses/c639a7a1f5d0bcf46db37368d3bb76349ec70d01"}}}}