{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-gossip/pulls/comments/101564909","pull_request_review_id":22297769,"id":101564909,"diff_hunk":"@@ -72,11 +55,12 @@\n   private final Meter messageSerdeException;\n   private final Meter tranmissionException;\n   private final Meter tranmissionSuccess;\n-  \n+  private final Map<Class, MessageHandler> handlers;","path":"src/main/java/org/apache/gossip/manager/GossipCore.java","position":73,"original_position":73,"commit_id":"2b9dae138953ce561ecba51d145c4720e208e3ba","original_commit_id":"2b9dae138953ce561ecba51d145c4720e208e3ba","user":{"login":"edwardcapriolo","id":1020364,"avatar_url":"https://avatars.githubusercontent.com/u/1020364?v=3","gravatar_id":"","url":"https://api.github.com/users/edwardcapriolo","html_url":"https://github.com/edwardcapriolo","followers_url":"https://api.github.com/users/edwardcapriolo/followers","following_url":"https://api.github.com/users/edwardcapriolo/following{/other_user}","gists_url":"https://api.github.com/users/edwardcapriolo/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardcapriolo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardcapriolo/subscriptions","organizations_url":"https://api.github.com/users/edwardcapriolo/orgs","repos_url":"https://api.github.com/users/edwardcapriolo/repos","events_url":"https://api.github.com/users/edwardcapriolo/events{/privacy}","received_events_url":"https://api.github.com/users/edwardcapriolo/received_events","type":"User","site_admin":false},"body":"Please put this inside GossipManager. I understand why you put it here, but we are moving away from GossipCore because of all the method chaining GossipService->GossipManager->GossipCore. Also should we use ConcurrentMap so that if handlers are added at runtime they will be seen?","created_at":"2017-02-16T16:33:54Z","updated_at":"2017-02-16T16:43:01Z","html_url":"https://github.com/apache/incubator-gossip/pull/34#discussion_r101564909","pull_request_url":"https://api.github.com/repos/apache/incubator-gossip/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-gossip/pulls/comments/101564909"},"html":{"href":"https://github.com/apache/incubator-gossip/pull/34#discussion_r101564909"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-gossip/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-gossip/pulls/34","id":106486856,"html_url":"https://github.com/apache/incubator-gossip/pull/34","diff_url":"https://github.com/apache/incubator-gossip/pull/34.diff","patch_url":"https://github.com/apache/incubator-gossip/pull/34.patch","issue_url":"https://api.github.com/repos/apache/incubator-gossip/issues/34","number":34,"state":"open","locked":false,"title":"GOSSIP-56 GossipCore should allow registration of handlers","user":{"login":"makrusak","id":823054,"avatar_url":"https://avatars.githubusercontent.com/u/823054?v=3","gravatar_id":"","url":"https://api.github.com/users/makrusak","html_url":"https://github.com/makrusak","followers_url":"https://api.github.com/users/makrusak/followers","following_url":"https://api.github.com/users/makrusak/following{/other_user}","gists_url":"https://api.github.com/users/makrusak/gists{/gist_id}","starred_url":"https://api.github.com/users/makrusak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makrusak/subscriptions","organizations_url":"https://api.github.com/users/makrusak/orgs","repos_url":"https://api.github.com/users/makrusak/repos","events_url":"https://api.github.com/users/makrusak/events{/privacy}","received_events_url":"https://api.github.com/users/makrusak/received_events","type":"User","site_admin":false},"body":"Current solution is:\r\n`\r\nfor (Map.Entry<Class, MessageHandler> handler : handlers.entrySet()) {\r\n     Class messageClass = handler.getKey();\r\n     MessageHandler messageHandler = handler.getValue();\r\n     if (messageClass.isAssignableFrom(base.getClass())){\r\n       messageHandler.invoke(this, gossipManager, base);\r\n       break;\r\n}`\r\nIt's thread-safe and it's not just handlers.get(base.getClass()) because, for example, UdpActiveGossipMessage extends ActiveGossipMessage and this type of message have to be handled as ActiveGossipMessage, but getClass() returns UdpActiveGossipMessage.","created_at":"2017-02-16T09:41:11Z","updated_at":"2017-02-16T16:43:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-gossip/pulls/34/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-gossip/pulls/34/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-gossip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-gossip/issues/34/comments","statuses_url":"https://api.github.com/repos/apache/incubator-gossip/statuses/2b9dae138953ce561ecba51d145c4720e208e3ba","head":{"label":"makrusak:GOSSIP-56","ref":"GOSSIP-56","sha":"2b9dae138953ce561ecba51d145c4720e208e3ba","user":{"login":"makrusak","id":823054,"avatar_url":"https://avatars.githubusercontent.com/u/823054?v=3","gravatar_id":"","url":"https://api.github.com/users/makrusak","html_url":"https://github.com/makrusak","followers_url":"https://api.github.com/users/makrusak/followers","following_url":"https://api.github.com/users/makrusak/following{/other_user}","gists_url":"https://api.github.com/users/makrusak/gists{/gist_id}","starred_url":"https://api.github.com/users/makrusak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makrusak/subscriptions","organizations_url":"https://api.github.com/users/makrusak/orgs","repos_url":"https://api.github.com/users/makrusak/repos","events_url":"https://api.github.com/users/makrusak/events{/privacy}","received_events_url":"https://api.github.com/users/makrusak/received_events","type":"User","site_admin":false},"repo":{"id":81964317,"name":"incubator-gossip","full_name":"makrusak/incubator-gossip","owner":{"login":"makrusak","id":823054,"avatar_url":"https://avatars.githubusercontent.com/u/823054?v=3","gravatar_id":"","url":"https://api.github.com/users/makrusak","html_url":"https://github.com/makrusak","followers_url":"https://api.github.com/users/makrusak/followers","following_url":"https://api.github.com/users/makrusak/following{/other_user}","gists_url":"https://api.github.com/users/makrusak/gists{/gist_id}","starred_url":"https://api.github.com/users/makrusak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makrusak/subscriptions","organizations_url":"https://api.github.com/users/makrusak/orgs","repos_url":"https://api.github.com/users/makrusak/repos","events_url":"https://api.github.com/users/makrusak/events{/privacy}","received_events_url":"https://api.github.com/users/makrusak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/makrusak/incubator-gossip","description":"Mirror of Apache Gossip Incubator","fork":true,"url":"https://api.github.com/repos/makrusak/incubator-gossip","forks_url":"https://api.github.com/repos/makrusak/incubator-gossip/forks","keys_url":"https://api.github.com/repos/makrusak/incubator-gossip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makrusak/incubator-gossip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makrusak/incubator-gossip/teams","hooks_url":"https://api.github.com/repos/makrusak/incubator-gossip/hooks","issue_events_url":"https://api.github.com/repos/makrusak/incubator-gossip/issues/events{/number}","events_url":"https://api.github.com/repos/makrusak/incubator-gossip/events","assignees_url":"https://api.github.com/repos/makrusak/incubator-gossip/assignees{/user}","branches_url":"https://api.github.com/repos/makrusak/incubator-gossip/branches{/branch}","tags_url":"https://api.github.com/repos/makrusak/incubator-gossip/tags","blobs_url":"https://api.github.com/repos/makrusak/incubator-gossip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makrusak/incubator-gossip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makrusak/incubator-gossip/git/refs{/sha}","trees_url":"https://api.github.com/repos/makrusak/incubator-gossip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makrusak/incubator-gossip/statuses/{sha}","languages_url":"https://api.github.com/repos/makrusak/incubator-gossip/languages","stargazers_url":"https://api.github.com/repos/makrusak/incubator-gossip/stargazers","contributors_url":"https://api.github.com/repos/makrusak/incubator-gossip/contributors","subscribers_url":"https://api.github.com/repos/makrusak/incubator-gossip/subscribers","subscription_url":"https://api.github.com/repos/makrusak/incubator-gossip/subscription","commits_url":"https://api.github.com/repos/makrusak/incubator-gossip/commits{/sha}","git_commits_url":"https://api.github.com/repos/makrusak/incubator-gossip/git/commits{/sha}","comments_url":"https://api.github.com/repos/makrusak/incubator-gossip/comments{/number}","issue_comment_url":"https://api.github.com/repos/makrusak/incubator-gossip/issues/comments{/number}","contents_url":"https://api.github.com/repos/makrusak/incubator-gossip/contents/{+path}","compare_url":"https://api.github.com/repos/makrusak/incubator-gossip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makrusak/incubator-gossip/merges","archive_url":"https://api.github.com/repos/makrusak/incubator-gossip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makrusak/incubator-gossip/downloads","issues_url":"https://api.github.com/repos/makrusak/incubator-gossip/issues{/number}","pulls_url":"https://api.github.com/repos/makrusak/incubator-gossip/pulls{/number}","milestones_url":"https://api.github.com/repos/makrusak/incubator-gossip/milestones{/number}","notifications_url":"https://api.github.com/repos/makrusak/incubator-gossip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makrusak/incubator-gossip/labels{/name}","releases_url":"https://api.github.com/repos/makrusak/incubator-gossip/releases{/id}","deployments_url":"https://api.github.com/repos/makrusak/incubator-gossip/deployments","created_at":"2017-02-14T16:17:44Z","updated_at":"2017-02-14T16:17:46Z","pushed_at":"2017-02-16T09:36:22Z","git_url":"git://github.com/makrusak/incubator-gossip.git","ssh_url":"git@github.com:makrusak/incubator-gossip.git","clone_url":"https://github.com/makrusak/incubator-gossip.git","svn_url":"https://github.com/makrusak/incubator-gossip","homepage":null,"size":1194,"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":"7106cc400ab7750fb3a503a1490a2bd1d3c9f741","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":59881768,"name":"incubator-gossip","full_name":"apache/incubator-gossip","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/incubator-gossip","description":"Mirror of Apache Gossip Incubator","fork":false,"url":"https://api.github.com/repos/apache/incubator-gossip","forks_url":"https://api.github.com/repos/apache/incubator-gossip/forks","keys_url":"https://api.github.com/repos/apache/incubator-gossip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-gossip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-gossip/teams","hooks_url":"https://api.github.com/repos/apache/incubator-gossip/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-gossip/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-gossip/events","assignees_url":"https://api.github.com/repos/apache/incubator-gossip/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-gossip/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-gossip/tags","blobs_url":"https://api.github.com/repos/apache/incubator-gossip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-gossip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-gossip/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-gossip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-gossip/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-gossip/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-gossip/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-gossip/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-gossip/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-gossip/subscription","commits_url":"https://api.github.com/repos/apache/incubator-gossip/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-gossip/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-gossip/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-gossip/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-gossip/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-gossip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-gossip/merges","archive_url":"https://api.github.com/repos/apache/incubator-gossip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-gossip/downloads","issues_url":"https://api.github.com/repos/apache/incubator-gossip/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-gossip/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-gossip/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-gossip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-gossip/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-gossip/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-gossip/deployments","created_at":"2016-05-28T07:00:05Z","updated_at":"2017-02-15T16:03:40Z","pushed_at":"2017-02-16T09:41:11Z","git_url":"git://github.com/apache/incubator-gossip.git","ssh_url":"git@github.com:apache/incubator-gossip.git","clone_url":"https://github.com/apache/incubator-gossip.git","svn_url":"https://github.com/apache/incubator-gossip","homepage":null,"size":1184,"stargazers_count":39,"watchers_count":39,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":25,"mirror_url":"git://git.apache.org/incubator-gossip.git","open_issues_count":2,"forks":25,"open_issues":2,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-gossip/pulls/34"},"html":{"href":"https://github.com/apache/incubator-gossip/pull/34"},"issue":{"href":"https://api.github.com/repos/apache/incubator-gossip/issues/34"},"comments":{"href":"https://api.github.com/repos/apache/incubator-gossip/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-gossip/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-gossip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-gossip/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-gossip/statuses/2b9dae138953ce561ecba51d145c4720e208e3ba"}}}}
{"actor":{"display_login":"edwardcapriolo"}}