{"action":"created","comment":{"url":"https://api.github.com/repos/netty/netty/pulls/comments/32363032","id":32363032,"diff_hunk":"@@ -227,6 +258,85 @@ public ChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead) {\n     }\n \n     @Override\n+    public int getMaxBytesPerRead() {\n+        return maxBytesPerRead;\n+    }\n+\n+    @Override\n+    public ChannelConfig setMaxBytesPerRead(int maxBytesPerRead) {\n+        if (maxBytesPerRead <= 0) {\n+            throw new IllegalArgumentException(\"maxBytesPerRead: \" + maxBytesPerRead + \" (expected: > 0)\");\n+        }\n+        // There is a dependency between this.maxBytesPerRead and this.maxBytesPerIndividualRead (a < b).\n+        // Write operations must be synchronized, but independent read operations can just be volatile.\n+        synchronized (this) {\n+            final int maxBytesPerIndividualRead = getMaxBytesPerIndividualRead();\n+            if (maxBytesPerRead < maxBytesPerIndividualRead) {\n+                throw new IllegalArgumentException(\n+                        \"maxBytesPerRead cannot be less than \" +\n+                                \"maxBytesPerIndividualRead (\" + maxBytesPerIndividualRead + \"): \" + maxBytesPerRead);\n+            }\n+\n+            this.maxBytesPerRead = maxBytesPerRead;\n+        }\n+        return this;\n+    }\n+\n+    @Override\n+    public int getMaxBytesPerIndividualRead() {\n+        return maxBytesPerIndividualRead;\n+    }\n+\n+    @Override\n+    public ChannelConfig setMaxBytesPerIndividualRead(int maxBytesPerIndividualRead) {\n+        if (maxBytesPerIndividualRead <= 0) {\n+            throw new IllegalArgumentException(\n+                    \"maxBytesPerIndividualRead: \" + maxBytesPerIndividualRead + \" (expected: > 0)\");\n+        }\n+        // There is a dependency between this.maxBytesPerRead and this.maxBytesPerIndividualRead (a < b).\n+        // Write operations must be synchronized, but independent read operations can just be volatile.\n+        synchronized (this) {\n+            final int maxBytesPerRead = getMaxBytesPerRead();\n+            if (maxBytesPerIndividualRead > maxBytesPerRead) {\n+                throw new IllegalArgumentException(\n+                        \"maxBytesPerIndividualRead cannot be greater than \" +\n+                                \"maxBytesPerRead (\" + maxBytesPerRead + \"): \" + maxBytesPerIndividualRead);\n+            }\n+\n+            this.maxBytesPerIndividualRead = maxBytesPerIndividualRead;\n+        }\n+        return this;\n+    }\n+\n+    @Override\n+    public synchronized Entry<Integer, Integer> getMaxBytesPerReadPair() {\n+        return new AbstractMap.SimpleEntry<Integer, Integer>(maxBytesPerRead, maxBytesPerIndividualRead);\n+    }\n+\n+    @Override\n+    public ChannelConfig setMaxBytesPerReadPair(int maxBytesPerRead, int maxBytesPerIndividualRead) {","path":"transport/src/main/java/io/netty/channel/DefaultChannelConfig.java","position":146,"original_position":146,"commit_id":"e8189426da0bddd0f960967e62931e2cfe6f548c","original_commit_id":"e8189426da0bddd0f960967e62931e2cfe6f548c","user":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"body":"I think something similar can be done to resolve https://github.com/netty/netty/issues/3806.","created_at":"2015-06-12T23:15:59Z","updated_at":"2015-06-12T23:15:59Z","html_url":"https://github.com/netty/netty/pull/3885#discussion_r32363032","pull_request_url":"https://api.github.com/repos/netty/netty/pulls/3885","_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/comments/32363032"},"html":{"href":"https://github.com/netty/netty/pull/3885#discussion_r32363032"},"pull_request":{"href":"https://api.github.com/repos/netty/netty/pulls/3885"}}},"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/3885","id":37600857,"html_url":"https://github.com/netty/netty/pull/3885","diff_url":"https://github.com/netty/netty/pull/3885.diff","patch_url":"https://github.com/netty/netty/pull/3885.patch","issue_url":"https://api.github.com/repos/netty/netty/issues/3885","number":3885,"state":"open","locked":false,"title":"maxBytesPerRead channel configuration","user":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"body":"Motiviation:\r\nThe current read loops don't fascilitate reading a maximum amount of bytes. This capability is useful to have more fine grain control over how much data is injested.\r\n\r\nModifications:\r\n- Add a setMaxBytesPerRead(int) and getMaxBytesPerRead() to ChannelConfig\r\n- Add a setMaxBytesPerIndividualRead(int) and getMaxBytesPerIndividualRead to ChannelConfig\r\n- Add methods to RecvByteBufAllocator so that a pluggable scheme can be used to control the behavior of the read loop.\r\n- Modify read loop for all transport types to respect the new RecvByteBufAllocator API\r\n\r\nResult:\r\nThe ability to control how many bytes are read for each read operation/loop, and a more extensible read loop.","created_at":"2015-06-12T20:24:44Z","updated_at":"2015-06-12T23:15:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36c38b28b56b3890f9a4feb2031c4422dcb19217","assignee":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/netty/netty/milestones/117","html_url":"https://github.com/netty/netty/milestones/4.1.0.Beta6","labels_url":"https://api.github.com/repos/netty/netty/milestones/117/labels","id":1100817,"number":117,"title":"4.1.0.Beta6","description":"","creator":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=3","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"open_issues":66,"closed_issues":30,"state":"open","created_at":"2015-05-07T19:29:09Z","updated_at":"2015-06-12T20:25:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/netty/netty/pulls/3885/commits","review_comments_url":"https://api.github.com/repos/netty/netty/pulls/3885/comments","review_comment_url":"https://api.github.com/repos/netty/netty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/netty/netty/issues/3885/comments","statuses_url":"https://api.github.com/repos/netty/netty/statuses/e8189426da0bddd0f960967e62931e2cfe6f548c","head":{"label":"Scottmitch:read_max_bytes","ref":"read_max_bytes","sha":"e8189426da0bddd0f960967e62931e2cfe6f548c","user":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"repo":{"id":21251366,"name":"netty","full_name":"Scottmitch/netty","owner":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=3","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Scottmitch/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":true,"url":"https://api.github.com/repos/Scottmitch/netty","forks_url":"https://api.github.com/repos/Scottmitch/netty/forks","keys_url":"https://api.github.com/repos/Scottmitch/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Scottmitch/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Scottmitch/netty/teams","hooks_url":"https://api.github.com/repos/Scottmitch/netty/hooks","issue_events_url":"https://api.github.com/repos/Scottmitch/netty/issues/events{/number}","events_url":"https://api.github.com/repos/Scottmitch/netty/events","assignees_url":"https://api.github.com/repos/Scottmitch/netty/assignees{/user}","branches_url":"https://api.github.com/repos/Scottmitch/netty/branches{/branch}","tags_url":"https://api.github.com/repos/Scottmitch/netty/tags","blobs_url":"https://api.github.com/repos/Scottmitch/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Scottmitch/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Scottmitch/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/Scottmitch/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Scottmitch/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/Scottmitch/netty/languages","stargazers_url":"https://api.github.com/repos/Scottmitch/netty/stargazers","contributors_url":"https://api.github.com/repos/Scottmitch/netty/contributors","subscribers_url":"https://api.github.com/repos/Scottmitch/netty/subscribers","subscription_url":"https://api.github.com/repos/Scottmitch/netty/subscription","commits_url":"https://api.github.com/repos/Scottmitch/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/Scottmitch/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/Scottmitch/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/Scottmitch/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/Scottmitch/netty/contents/{+path}","compare_url":"https://api.github.com/repos/Scottmitch/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Scottmitch/netty/merges","archive_url":"https://api.github.com/repos/Scottmitch/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Scottmitch/netty/downloads","issues_url":"https://api.github.com/repos/Scottmitch/netty/issues{/number}","pulls_url":"https://api.github.com/repos/Scottmitch/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/Scottmitch/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/Scottmitch/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Scottmitch/netty/labels{/name}","releases_url":"https://api.github.com/repos/Scottmitch/netty/releases{/id}","created_at":"2014-06-26T18:56:19Z","updated_at":"2015-02-02T14:45:48Z","pushed_at":"2015-06-12T23:13:23Z","git_url":"git://github.com/Scottmitch/netty.git","ssh_url":"git@github.com:Scottmitch/netty.git","clone_url":"https://github.com/Scottmitch/netty.git","svn_url":"https://github.com/Scottmitch/netty","homepage":"http://netty.io/","size":42852,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"netty:4.1","ref":"4.1","sha":"09d826ed46cba3876d4e35231038c0c9d4e301da","user":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=3","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"repo":{"id":1064563,"name":"netty","full_name":"netty/netty","owner":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=3","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/netty/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":false,"url":"https://api.github.com/repos/netty/netty","forks_url":"https://api.github.com/repos/netty/netty/forks","keys_url":"https://api.github.com/repos/netty/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/netty/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/netty/netty/teams","hooks_url":"https://api.github.com/repos/netty/netty/hooks","issue_events_url":"https://api.github.com/repos/netty/netty/issues/events{/number}","events_url":"https://api.github.com/repos/netty/netty/events","assignees_url":"https://api.github.com/repos/netty/netty/assignees{/user}","branches_url":"https://api.github.com/repos/netty/netty/branches{/branch}","tags_url":"https://api.github.com/repos/netty/netty/tags","blobs_url":"https://api.github.com/repos/netty/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/netty/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/netty/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/netty/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/netty/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/netty/netty/languages","stargazers_url":"https://api.github.com/repos/netty/netty/stargazers","contributors_url":"https://api.github.com/repos/netty/netty/contributors","subscribers_url":"https://api.github.com/repos/netty/netty/subscribers","subscription_url":"https://api.github.com/repos/netty/netty/subscription","commits_url":"https://api.github.com/repos/netty/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/netty/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/netty/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/netty/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/netty/netty/contents/{+path}","compare_url":"https://api.github.com/repos/netty/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/netty/netty/merges","archive_url":"https://api.github.com/repos/netty/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/netty/netty/downloads","issues_url":"https://api.github.com/repos/netty/netty/issues{/number}","pulls_url":"https://api.github.com/repos/netty/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/netty/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/netty/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/netty/netty/labels{/name}","releases_url":"https://api.github.com/repos/netty/netty/releases{/id}","created_at":"2010-11-09T09:22:21Z","updated_at":"2015-06-12T17:03:04Z","pushed_at":"2015-06-12T23:13:25Z","git_url":"git://github.com/netty/netty.git","ssh_url":"git@github.com:netty/netty.git","clone_url":"https://github.com/netty/netty.git","svn_url":"https://github.com/netty/netty","homepage":"http://netty.io/","size":128199,"stargazers_count":4759,"watchers_count":4759,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2354,"mirror_url":null,"open_issues_count":276,"forks":2354,"open_issues":276,"watchers":4759,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/3885"},"html":{"href":"https://github.com/netty/netty/pull/3885"},"issue":{"href":"https://api.github.com/repos/netty/netty/issues/3885"},"comments":{"href":"https://api.github.com/repos/netty/netty/issues/3885/comments"},"review_comments":{"href":"https://api.github.com/repos/netty/netty/pulls/3885/comments"},"review_comment":{"href":"https://api.github.com/repos/netty/netty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/netty/netty/pulls/3885/commits"},"statuses":{"href":"https://api.github.com/repos/netty/netty/statuses/e8189426da0bddd0f960967e62931e2cfe6f548c"}}}}