GitHub PullRequestReviewCommentEvent at 2014-12-04 16:44:18
Repository: akka
Actor: patriknw
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/21316902","id":21316902,"diff_hunk":"@@ -32,18 +38,46 @@ object ProtobufSerializer {\n  * This Serializer serializes `com.google.protobuf.Message`s\n  */\n class ProtobufSerializer extends Serializer {\n-  val ARRAY_OF_BYTE_ARRAY = Array[Class[_]](classOf[Array[Byte]])\n-  def includeManifest: Boolean = true\n-  def identifier = 2\n \n-  def toBinary(obj: AnyRef): Array[Byte] = obj match {\n-    case m: Message ⇒ m.toByteArray\n-    case _          ⇒ throw new IllegalArgumentException(\"Can't serialize a non-protobuf message using protobuf [\" + obj + \"]\")\n-  }\n+  private val parsingMethodBindingRef = new AtomicReference[Map[Class[_], Method]](Map.empty[Class[_], Method])\n+\n+  override def identifier: Int = 2\n \n-  def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef =\n-    clazz match {\n-      case None    ⇒ throw new IllegalArgumentException(\"Need a protobuf message class to be able to serialize bytes using protobuf\")\n-      case Some(c) ⇒ c.getDeclaredMethod(\"parseFrom\", ARRAY_OF_BYTE_ARRAY: _*).invoke(null, bytes).asInstanceOf[Message]\n+  override def includeManifest: Boolean = true\n+\n+  override def fromBinary(bytes: Array[Byte], manifest: Option[Class[_]]): AnyRef = {\n+    manifest match {\n+      case Some(clazz) ⇒\n+        @tailrec\n+        def parse(maybeCachedParsingMethod: Method): Message = {\n+          if (maybeCachedParsingMethod ne null)\n+            maybeCachedParsingMethod.invoke(null, bytes).asInstanceOf[Message]\n+          else {\n+            @tailrec\n+            def cacheMethod(parsingMethod: Method): Method = {\n+              val parsingMethodBinding = parsingMethodBindingRef.get()","path":"akka-remote/src/main/scala/akka/remote/serialization/ProtobufSerializer.scala","position":53,"original_position":53,"commit_id":"a71e15293a7777de336ee496d241a3497b7ba4e6","original_commit_id":"a71e15293a7777de336ee496d241a3497b7ba4e6","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"val not needed,\r\n\r\n    parsingMethodBindingRef.get() match {","created_at":"2014-12-04T16:44:18Z","updated_at":"2014-12-04T16:44:18Z","html_url":"https://github.com/akka/akka/pull/16429#discussion_r21316902","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/16429","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/21316902"},"html":{"href":"https://github.com/akka/akka/pull/16429#discussion_r21316902"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/16429"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/16429","id":25220951,"html_url":"https://github.com/akka/akka/pull/16429","diff_url":"https://github.com/akka/akka/pull/16429.diff","patch_url":"https://github.com/akka/akka/pull/16429.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/16429","number":16429,"state":"open","locked":false,"title":"=rem #16428 optimize protobuf serializer for master","user":{"login":"hepin1989","id":501740,"avatar_url":"https://avatars.githubusercontent.com/u/501740?v=3","gravatar_id":"","url":"https://api.github.com/users/hepin1989","html_url":"https://github.com/hepin1989","followers_url":"https://api.github.com/users/hepin1989/followers","following_url":"https://api.github.com/users/hepin1989/following{/other_user}","gists_url":"https://api.github.com/users/hepin1989/gists{/gist_id}","starred_url":"https://api.github.com/users/hepin1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hepin1989/subscriptions","organizations_url":"https://api.github.com/users/hepin1989/orgs","repos_url":"https://api.github.com/users/hepin1989/repos","events_url":"https://api.github.com/users/hepin1989/events{/privacy}","received_events_url":"https://api.github.com/users/hepin1989/received_events","type":"User","site_admin":false},"body":"#16428 for master","created_at":"2014-11-29T09:13:18Z","updated_at":"2014-12-04T16:44:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dec9dd5d5a7a9a383399df7faa28a0a048dbe093","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/16429/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/16429/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments/{number}","comments_url":"https://api.github.com/repos/akka/akka/issues/16429/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/a71e15293a7777de336ee496d241a3497b7ba4e6","head":{"label":"hepin1989:master","ref":"master","sha":"a71e15293a7777de336ee496d241a3497b7ba4e6","user":{"login":"hepin1989","id":501740,"avatar_url":"https://avatars.githubusercontent.com/u/501740?v=3","gravatar_id":"","url":"https://api.github.com/users/hepin1989","html_url":"https://github.com/hepin1989","followers_url":"https://api.github.com/users/hepin1989/followers","following_url":"https://api.github.com/users/hepin1989/following{/other_user}","gists_url":"https://api.github.com/users/hepin1989/gists{/gist_id}","starred_url":"https://api.github.com/users/hepin1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hepin1989/subscriptions","organizations_url":"https://api.github.com/users/hepin1989/orgs","repos_url":"https://api.github.com/users/hepin1989/repos","events_url":"https://api.github.com/users/hepin1989/events{/privacy}","received_events_url":"https://api.github.com/users/hepin1989/received_events","type":"User","site_admin":false},"repo":{"id":27296198,"name":"akka","full_name":"hepin1989/akka","owner":{"login":"hepin1989","id":501740,"avatar_url":"https://avatars.githubusercontent.com/u/501740?v=3","gravatar_id":"","url":"https://api.github.com/users/hepin1989","html_url":"https://github.com/hepin1989","followers_url":"https://api.github.com/users/hepin1989/followers","following_url":"https://api.github.com/users/hepin1989/following{/other_user}","gists_url":"https://api.github.com/users/hepin1989/gists{/gist_id}","starred_url":"https://api.github.com/users/hepin1989/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hepin1989/subscriptions","organizations_url":"https://api.github.com/users/hepin1989/orgs","repos_url":"https://api.github.com/users/hepin1989/repos","events_url":"https://api.github.com/users/hepin1989/events{/privacy}","received_events_url":"https://api.github.com/users/hepin1989/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hepin1989/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/hepin1989/akka","forks_url":"https://api.github.com/repos/hepin1989/akka/forks","keys_url":"https://api.github.com/repos/hepin1989/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hepin1989/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hepin1989/akka/teams","hooks_url":"https://api.github.com/repos/hepin1989/akka/hooks","issue_events_url":"https://api.github.com/repos/hepin1989/akka/issues/events{/number}","events_url":"https://api.github.com/repos/hepin1989/akka/events","assignees_url":"https://api.github.com/repos/hepin1989/akka/assignees{/user}","branches_url":"https://api.github.com/repos/hepin1989/akka/branches{/branch}","tags_url":"https://api.github.com/repos/hepin1989/akka/tags","blobs_url":"https://api.github.com/repos/hepin1989/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hepin1989/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hepin1989/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/hepin1989/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hepin1989/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/hepin1989/akka/languages","stargazers_url":"https://api.github.com/repos/hepin1989/akka/stargazers","contributors_url":"https://api.github.com/repos/hepin1989/akka/contributors","subscribers_url":"https://api.github.com/repos/hepin1989/akka/subscribers","subscription_url":"https://api.github.com/repos/hepin1989/akka/subscription","commits_url":"https://api.github.com/repos/hepin1989/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/hepin1989/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/hepin1989/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/hepin1989/akka/issues/comments/{number}","contents_url":"https://api.github.com/repos/hepin1989/akka/contents/{+path}","compare_url":"https://api.github.com/repos/hepin1989/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hepin1989/akka/merges","archive_url":"https://api.github.com/repos/hepin1989/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hepin1989/akka/downloads","issues_url":"https://api.github.com/repos/hepin1989/akka/issues{/number}","pulls_url":"https://api.github.com/repos/hepin1989/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/hepin1989/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/hepin1989/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hepin1989/akka/labels{/name}","releases_url":"https://api.github.com/repos/hepin1989/akka/releases{/id}","created_at":"2014-11-29T08:37:24Z","updated_at":"2014-12-04T06:12:21Z","pushed_at":"2014-12-04T06:12:18Z","git_url":"git://github.com/hepin1989/akka.git","ssh_url":"git@github.com:hepin1989/akka.git","clone_url":"https://github.com/hepin1989/akka.git","svn_url":"https://github.com/hepin1989/akka","homepage":"http://akka.io","size":156782,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"akka:master","ref":"master","sha":"8170a9770ff35f8ec4431c8e4139c4d662f170da","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments/{number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","created_at":"2009-02-16T12:51:54Z","updated_at":"2014-12-04T13:55:31Z","pushed_at":"2014-12-03T20:30:32Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":229736,"stargazers_count":3259,"watchers_count":3259,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":911,"mirror_url":null,"open_issues_count":494,"forks":911,"open_issues":494,"watchers":3259,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/16429"},"html":{"href":"https://github.com/akka/akka/pull/16429"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/16429"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/16429/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/16429/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/16429/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/a71e15293a7777de336ee496d241a3497b7ba4e6"}}}}