{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/25770640","id":25770640,"diff_hunk":"@@ -171,36 +173,37 @@ public void fromJson(JsonObject json) {\n     }\n \n     static final class Invocation implements JsonSerializable {\n+        // values are just set once, but cannot be final due to JsonSerializable\n         int id;\n         long startedAt;\n-        long durationNanos;\n-        volatile long lastAccessNanos;\n \n-        public long getDurationNanos() {\n-            return durationNanos;\n+        // only accessed by single SlowOperationDetectorThread, no need for synchronization\n+        long lastAccessNanos;\n+\n+        // this field will be changed by single SlowOperationDetectorThread only (they can be read by multiple threads)\n+        volatile int durationMs;\n+\n+        public long getDurationMs() {\n+            return durationMs;\n         }\n \n         @Override\n         public String toString() {\n-            // NOP to read lastAccess to update local thread values\n-            if (lastAccessNanos < 0) {\n-                assert true;\n-            }\n+            // read durationMs first to enforce a read barrier\n+            int tmpDurationMs = durationMs;\n \n-            return \"Invocation{\" + \"id=\" + id + \", startedAt=\" + startedAt + \", durationNanos=\" + durationNanos + '}';\n+            return \"Invocation{\" + \"id=\" + id + \", startedAt=\" + startedAt + \", durationMs=\" + tmpDurationMs + '}';\n         }\n \n         @Override\n         public JsonObject toJson() {\n-            // NOP to read lastAccess to update local thread values\n-            if (lastAccessNanos < 0) {\n-                assert true;\n-            }\n+            // read durationMs first to enforce a read barrier\n+            int tmpDurationMs = durationMs;","path":"hazelcast/src/main/java/com/hazelcast/spi/impl/SlowOperationLog.java","position":83,"original_position":83,"commit_id":"ce29f4cdb8799b36396cafb5080759ee9ccab408","original_commit_id":"ce29f4cdb8799b36396cafb5080759ee9ccab408","user":{"login":"Donnerbart","id":4196298,"avatar_url":"https://avatars.githubusercontent.com/u/4196298?v=3","gravatar_id":"","url":"https://api.github.com/users/Donnerbart","html_url":"https://github.com/Donnerbart","followers_url":"https://api.github.com/users/Donnerbart/followers","following_url":"https://api.github.com/users/Donnerbart/following{/other_user}","gists_url":"https://api.github.com/users/Donnerbart/gists{/gist_id}","starred_url":"https://api.github.com/users/Donnerbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Donnerbart/subscriptions","organizations_url":"https://api.github.com/users/Donnerbart/orgs","repos_url":"https://api.github.com/users/Donnerbart/repos","events_url":"https://api.github.com/users/Donnerbart/events{/privacy}","received_events_url":"https://api.github.com/users/Donnerbart/received_events","type":"User","site_admin":false},"body":"The values are not set in the constructor, so we can't rely on safe publication. They are set once, but after the construction.","created_at":"2015-03-04T12:25:11Z","updated_at":"2015-03-04T12:25:11Z","html_url":"https://github.com/hazelcast/hazelcast/pull/4725#discussion_r25770640","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/25770640"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/4725#discussion_r25770640"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725"}}},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725","id":30453602,"html_url":"https://github.com/hazelcast/hazelcast/pull/4725","diff_url":"https://github.com/hazelcast/hazelcast/pull/4725.diff","patch_url":"https://github.com/hazelcast/hazelcast/pull/4725.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/4725","number":4725,"state":"open","locked":false,"title":"Simplified and documented concurrency behavior of SlowOperationLog","user":{"login":"Donnerbart","id":4196298,"avatar_url":"https://avatars.githubusercontent.com/u/4196298?v=3","gravatar_id":"","url":"https://api.github.com/users/Donnerbart","html_url":"https://github.com/Donnerbart","followers_url":"https://api.github.com/users/Donnerbart/followers","following_url":"https://api.github.com/users/Donnerbart/following{/other_user}","gists_url":"https://api.github.com/users/Donnerbart/gists{/gist_id}","starred_url":"https://api.github.com/users/Donnerbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Donnerbart/subscriptions","organizations_url":"https://api.github.com/users/Donnerbart/orgs","repos_url":"https://api.github.com/users/Donnerbart/repos","events_url":"https://api.github.com/users/Donnerbart/events{/privacy}","received_events_url":"https://api.github.com/users/Donnerbart/received_events","type":"User","site_admin":false},"body":"* Simplified and documented concurrency behavior of `SlowOperationLog`. There is just a single writer in this scenario, which is already stated in the class documentation.\r\n* Fixed wrong variable name (duration is in milliseconds, not nanoseconds).","created_at":"2015-03-04T10:30:40Z","updated_at":"2015-03-04T12:25:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f99ca807d0a1765789f10f414624e69d9364ea6b","assignee":{"login":"Donnerbart","id":4196298,"avatar_url":"https://avatars.githubusercontent.com/u/4196298?v=3","gravatar_id":"","url":"https://api.github.com/users/Donnerbart","html_url":"https://github.com/Donnerbart","followers_url":"https://api.github.com/users/Donnerbart/followers","following_url":"https://api.github.com/users/Donnerbart/following{/other_user}","gists_url":"https://api.github.com/users/Donnerbart/gists{/gist_id}","starred_url":"https://api.github.com/users/Donnerbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Donnerbart/subscriptions","organizations_url":"https://api.github.com/users/Donnerbart/orgs","repos_url":"https://api.github.com/users/Donnerbart/repos","events_url":"https://api.github.com/users/Donnerbart/events{/privacy}","received_events_url":"https://api.github.com/users/Donnerbart/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/55","html_url":"https://github.com/hazelcast/hazelcast/milestones/3.5","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/55/labels","id":819785,"number":55,"title":"3.5","description":null,"creator":{"login":"sancar","id":570462,"avatar_url":"https://avatars.githubusercontent.com/u/570462?v=3","gravatar_id":"","url":"https://api.github.com/users/sancar","html_url":"https://github.com/sancar","followers_url":"https://api.github.com/users/sancar/followers","following_url":"https://api.github.com/users/sancar/following{/other_user}","gists_url":"https://api.github.com/users/sancar/gists{/gist_id}","starred_url":"https://api.github.com/users/sancar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sancar/subscriptions","organizations_url":"https://api.github.com/users/sancar/orgs","repos_url":"https://api.github.com/users/sancar/repos","events_url":"https://api.github.com/users/sancar/events{/privacy}","received_events_url":"https://api.github.com/users/sancar/received_events","type":"User","site_admin":false},"open_issues":89,"closed_issues":203,"state":"open","created_at":"2014-10-09T13:04:53Z","updated_at":"2015-03-04T11:49:02Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/4725/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/ce29f4cdb8799b36396cafb5080759ee9ccab408","head":{"label":"Donnerbart:fixConcurrenyIssuesInSlowOperationLog","ref":"fixConcurrenyIssuesInSlowOperationLog","sha":"ce29f4cdb8799b36396cafb5080759ee9ccab408","user":{"login":"Donnerbart","id":4196298,"avatar_url":"https://avatars.githubusercontent.com/u/4196298?v=3","gravatar_id":"","url":"https://api.github.com/users/Donnerbart","html_url":"https://github.com/Donnerbart","followers_url":"https://api.github.com/users/Donnerbart/followers","following_url":"https://api.github.com/users/Donnerbart/following{/other_user}","gists_url":"https://api.github.com/users/Donnerbart/gists{/gist_id}","starred_url":"https://api.github.com/users/Donnerbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Donnerbart/subscriptions","organizations_url":"https://api.github.com/users/Donnerbart/orgs","repos_url":"https://api.github.com/users/Donnerbart/repos","events_url":"https://api.github.com/users/Donnerbart/events{/privacy}","received_events_url":"https://api.github.com/users/Donnerbart/received_events","type":"User","site_admin":false},"repo":{"id":13138412,"name":"hazelcast","full_name":"Donnerbart/hazelcast","owner":{"login":"Donnerbart","id":4196298,"avatar_url":"https://avatars.githubusercontent.com/u/4196298?v=3","gravatar_id":"","url":"https://api.github.com/users/Donnerbart","html_url":"https://github.com/Donnerbart","followers_url":"https://api.github.com/users/Donnerbart/followers","following_url":"https://api.github.com/users/Donnerbart/following{/other_user}","gists_url":"https://api.github.com/users/Donnerbart/gists{/gist_id}","starred_url":"https://api.github.com/users/Donnerbart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Donnerbart/subscriptions","organizations_url":"https://api.github.com/users/Donnerbart/orgs","repos_url":"https://api.github.com/users/Donnerbart/repos","events_url":"https://api.github.com/users/Donnerbart/events{/privacy}","received_events_url":"https://api.github.com/users/Donnerbart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Donnerbart/hazelcast","description":"Open Source In-Memory Data Grid","fork":true,"url":"https://api.github.com/repos/Donnerbart/hazelcast","forks_url":"https://api.github.com/repos/Donnerbart/hazelcast/forks","keys_url":"https://api.github.com/repos/Donnerbart/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Donnerbart/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Donnerbart/hazelcast/teams","hooks_url":"https://api.github.com/repos/Donnerbart/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/Donnerbart/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/Donnerbart/hazelcast/events","assignees_url":"https://api.github.com/repos/Donnerbart/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/Donnerbart/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/Donnerbart/hazelcast/tags","blobs_url":"https://api.github.com/repos/Donnerbart/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Donnerbart/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Donnerbart/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/Donnerbart/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Donnerbart/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/Donnerbart/hazelcast/languages","stargazers_url":"https://api.github.com/repos/Donnerbart/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/Donnerbart/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/Donnerbart/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/Donnerbart/hazelcast/subscription","commits_url":"https://api.github.com/repos/Donnerbart/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/Donnerbart/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/Donnerbart/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/Donnerbart/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/Donnerbart/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/Donnerbart/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Donnerbart/hazelcast/merges","archive_url":"https://api.github.com/repos/Donnerbart/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Donnerbart/hazelcast/downloads","issues_url":"https://api.github.com/repos/Donnerbart/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/Donnerbart/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/Donnerbart/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/Donnerbart/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Donnerbart/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/Donnerbart/hazelcast/releases{/id}","created_at":"2013-09-27T01:15:56Z","updated_at":"2015-03-04T01:40:44Z","pushed_at":"2015-03-04T10:30:05Z","git_url":"git://github.com/Donnerbart/hazelcast.git","ssh_url":"git@github.com:Donnerbart/hazelcast.git","clone_url":"https://github.com/Donnerbart/hazelcast.git","svn_url":"https://github.com/Donnerbart/hazelcast","homepage":"www.hazelcast.com","size":60836,"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":"81eb7217984566705825a5df4d33ec0c2641f972","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}","created_at":"2012-03-21T12:25:18Z","updated_at":"2015-03-04T12:14:11Z","pushed_at":"2015-03-04T12:14:11Z","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":121593,"stargazers_count":1039,"watchers_count":1039,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":491,"mirror_url":null,"open_issues_count":393,"forks":491,"open_issues":393,"watchers":1039,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/4725"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/4725"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/4725/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/4725/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast/statuses/ce29f4cdb8799b36396cafb5080759ee9ccab408"}}}}