{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/188160985","pull_request_review_id":120081492,"id":188160985,"diff_hunk":"@@ -0,0 +1,152 @@\n+/*\n+ * Copyright (c) 2008-2018, 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.spi;\n+\n+import com.hazelcast.spi.impl.NodeEngineImpl;\n+import com.hazelcast.spi.impl.operationservice.InternalOperationService;\n+import com.hazelcast.spi.serialization.SerializationService;\n+\n+import java.util.Set;\n+\n+/**\n+ * This is an internal class. So if you are a regular Hazelcast user, you don't want to use this class. You probably want to use\n+ * {@link com.hazelcast.core.Offloadable}.\n+ *\n+ * The Offload is a {@link CallStatus} designed when an 'source' operation needs to offload the processing of the operation to\n+ * a different system, e.g a different thread and at some point in the future a response will be ready. Offload instance can be\n+ * created by Operations that require offloading, for more information see the {@link Operation#call()}.\n+ *\n+ * If the operation 'offloads' some work, but doesn't send a response ever, {@link CallStatus#DONE_VOID} should be used instead.\n+ *\n+ * <h1>Response handling</h1>\n+ * When the {@link Offload#init(NodeEngineImpl, Set)} is called, the original {@link OperationResponseHandler} of the source\n+ * operation is decorated with one of designed for the offloading (see heartbeats for more info). This means that sending a\n+ * response for an offloaded operation, can be done using the regular response handling mechanism\n+ * (see {@link Operation#sendResponse(Object)} or {@link Operation#getOperationResponseHandler()}. But one should not modify\n+ * the response handler of an offloaded Operation because otherwise one could e.g. run into a memory leak (the source operation\n+ * will not be removed from the asynchronous operations).\n+ *\n+ * There is an important difference with exception handling. With regular operation when an exception is thrown, first the\n+ * {@link Operation#onExecutionFailure(Throwable)} is called before the {@link Operation#sendResponse(Object)} is called. But\n+ * with an offloaded operation, typically the {@link Operation#sendResponse(Object)} is called by the implementation of the\n+ * offloading logic. So if you need the {@link Operation#onExecutionFailure(Throwable)} to be executed, just as the sendResponse\n+ * call, the onExecuteFailure call is your own concern.\n+ *\n+ * <h1>Heartbeats</h1>\n+ * The Offload functionality automatically registers the source operation for operation heartbeats. The registration is done\n+ * when the {@link Offload#init(NodeEngineImpl, Set)} is called. And it is unregistered, as soon as a response is send to the\n+ * source operation. This is done by decorating updating the original response handler of the operation by wrapping it in\n+ * a decorating response handler that automatically deregisters on completion.\n+ *\n+ * Todo:\n+ * - Should an offload provide a guard against multiple responses?\n+ * - Should a method be added to Offload that automatically reschedules the 'source' operation on an operation thread? It\n+ * could also restore the original operationresponsehandler on the source operation.\n+ */\n+public abstract class Offload extends CallStatus {\n+\n+    protected InternalOperationService operationService;\n+    protected NodeEngine nodeEngine;\n+    protected ExecutionService executionService;\n+    protected SerializationService serializationService;\n+    private final Operation source;","path":"hazelcast/src/main/java/com/hazelcast/spi/Offload.java","position":66,"original_position":66,"commit_id":"d5e2b51817d441f04c121433d78db1498970af4b","original_commit_id":"d5e2b51817d441f04c121433d78db1498970af4b","user":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars2.githubusercontent.com/u/105243?v=4","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},"body":"I renamed it to 'offloadedOperation'","created_at":"2018-05-15T04:11:39Z","updated_at":"2018-05-15T04:11:39Z","html_url":"https://github.com/hazelcast/hazelcast/pull/11894#discussion_r188160985","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/188160985"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/11894#discussion_r188160985"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894"}},"in_reply_to_id":187922006},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894","id":155536959,"html_url":"https://github.com/hazelcast/hazelcast/pull/11894","diff_url":"https://github.com/hazelcast/hazelcast/pull/11894.diff","patch_url":"https://github.com/hazelcast/hazelcast/pull/11894.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/11894","number":11894,"state":"open","locked":false,"title":"Operation continuation offload abstraction","user":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars2.githubusercontent.com/u/105243?v=4","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},"body":"The Offloaded functionality is a CallStatus implementation tailored for\r\noffloaded operations.\r\n\r\nOne of the features it provides is automatic registration of the operations\r\nfor the purpose of heartbeats.\r\n\r\nThe following operations have been refactored to make use of this new functionality\r\n-  EntryOperation \r\n- AbstractCallableTaskOperation \r\n- QueryOperation\r\n- PartitionIteratingOperation\r\n\r\nFor enterprise PR see https://github.com/hazelcast/hazelcast-enterprise/pull/2103\r\n","created_at":"2017-11-30T07:32:09Z","updated_at":"2018-05-15T04:11:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8068bec5e1903e62c8b60482112825fca89480db","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":137752575,"url":"https://api.github.com/repos/hazelcast/hazelcast/labels/Team:%20Core","name":"Team: Core","color":"109def","default":false},{"id":67167369,"url":"https://api.github.com/repos/hazelcast/hazelcast/labels/Team:%20QuSP","name":"Team: QuSP","color":"bfe5bf","default":false}],"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/106","html_url":"https://github.com/hazelcast/hazelcast/milestone/106","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/106/labels","id":2867560,"number":106,"title":"3.11","description":"","creator":{"login":"jerrinot","id":158619,"avatar_url":"https://avatars1.githubusercontent.com/u/158619?v=4","gravatar_id":"","url":"https://api.github.com/users/jerrinot","html_url":"https://github.com/jerrinot","followers_url":"https://api.github.com/users/jerrinot/followers","following_url":"https://api.github.com/users/jerrinot/following{/other_user}","gists_url":"https://api.github.com/users/jerrinot/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrinot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrinot/subscriptions","organizations_url":"https://api.github.com/users/jerrinot/orgs","repos_url":"https://api.github.com/users/jerrinot/repos","events_url":"https://api.github.com/users/jerrinot/events{/privacy}","received_events_url":"https://api.github.com/users/jerrinot/received_events","type":"User","site_admin":false},"open_issues":240,"closed_issues":113,"state":"open","created_at":"2017-10-26T14:31:27Z","updated_at":"2018-05-14T16:56:05Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/11894/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/d5e2b51817d441f04c121433d78db1498970af4b","head":{"label":"pveentjer:v3.10/feature/offloaded","ref":"v3.10/feature/offloaded","sha":"d5e2b51817d441f04c121433d78db1498970af4b","user":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars2.githubusercontent.com/u/105243?v=4","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},"repo":{"id":10990111,"name":"hazelcast","full_name":"pveentjer/hazelcast","owner":{"login":"pveentjer","id":105243,"avatar_url":"https://avatars2.githubusercontent.com/u/105243?v=4","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},"private":false,"html_url":"https://github.com/pveentjer/hazelcast","description":"Open Source In-Memory Data Grid","fork":true,"url":"https://api.github.com/repos/pveentjer/hazelcast","forks_url":"https://api.github.com/repos/pveentjer/hazelcast/forks","keys_url":"https://api.github.com/repos/pveentjer/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pveentjer/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pveentjer/hazelcast/teams","hooks_url":"https://api.github.com/repos/pveentjer/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/pveentjer/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/pveentjer/hazelcast/events","assignees_url":"https://api.github.com/repos/pveentjer/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/pveentjer/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/pveentjer/hazelcast/tags","blobs_url":"https://api.github.com/repos/pveentjer/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pveentjer/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pveentjer/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/pveentjer/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pveentjer/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/pveentjer/hazelcast/languages","stargazers_url":"https://api.github.com/repos/pveentjer/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/pveentjer/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/pveentjer/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/pveentjer/hazelcast/subscription","commits_url":"https://api.github.com/repos/pveentjer/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/pveentjer/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/pveentjer/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/pveentjer/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/pveentjer/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/pveentjer/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pveentjer/hazelcast/merges","archive_url":"https://api.github.com/repos/pveentjer/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pveentjer/hazelcast/downloads","issues_url":"https://api.github.com/repos/pveentjer/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/pveentjer/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/pveentjer/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/pveentjer/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pveentjer/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/pveentjer/hazelcast/releases{/id}","deployments_url":"https://api.github.com/repos/pveentjer/hazelcast/deployments","created_at":"2013-06-27T07:15:08Z","updated_at":"2015-04-22T04:00:47Z","pushed_at":"2018-05-14T07:08:56Z","git_url":"git://github.com/pveentjer/hazelcast.git","ssh_url":"git@github.com:pveentjer/hazelcast.git","clone_url":"https://github.com/pveentjer/hazelcast.git","svn_url":"https://github.com/pveentjer/hazelcast","homepage":"www.hazelcast.com","size":128962,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hazelcast:master","ref":"master","sha":"c72162c7af92f5685552a8a4ff6144b67ca9637b","user":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars2.githubusercontent.com/u/1453152?v=4","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://avatars2.githubusercontent.com/u/1453152?v=4","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":"2018-05-14T16:56:15Z","pushed_at":"2018-05-14T19:04:27Z","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":"http://www.hazelcast.org","size":129374,"stargazers_count":2581,"watchers_count":2581,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1005,"mirror_url":null,"archived":false,"open_issues_count":657,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1005,"open_issues":657,"watchers":2581,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/11894"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/11894"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/11894/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/11894/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast/statuses/d5e2b51817d441f04c121433d78db1498970af4b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"pveentjer"}}