{"action":"created","comment":{"url":"https://api.github.com/repos/infinispan/infinispan/pulls/comments/35346598","id":35346598,"diff_hunk":"@@ -230,13 +233,37 @@ public void clearLockedKeys() {\n       lockedKeys = null;\n    }\n \n-   private boolean hasLockOrIsLockBackup(Object key) {\n-      //stopgap fix for ISPN-2728. The real fix would be to synchronize this with the intrinsic lock.\n+   @Override\n+   public boolean containsLockOrBackupLock(Object key) {\n       Set<Object> lockedKeysCopy = lockedKeys;\n       Set<Object> backupKeyLocksCopy = backupKeyLocks;\n       return (lockedKeysCopy != null && lockedKeysCopy.contains(key)) || (backupKeyLocksCopy != null && backupKeyLocksCopy.contains(key));\n    }\n \n+   @Override\n+   public boolean containsAnyLockOrBackupLock(Stream<Object> keys) {\n+      return findFirstLockedOrBackupLocked(keys) != null;\n+   }\n+\n+   @Override\n+   public Object findFirstLockedOrBackupLocked(Stream<Object> keys) {\n+      Set<Object> lockedKeysCopy = lockedKeys;\n+      Set<Object> backupKeyLocksCopy = backupKeyLocks;\n+      if (lockedKeysCopy != null && backupKeyLocksCopy != null) {\n+         return keys.filter(key -> lockedKeysCopy.contains(key) || backupKeyLocksCopy.contains(key)).findAny().orElse(null);\n+      } else if (lockedKeysCopy != null) {\n+         return keys.filter(lockedKeysCopy::contains).findAny().orElse(null);\n+      } else if (backupKeyLocksCopy != null) {\n+         return keys.filter(backupKeyLocksCopy::contains).findAny().orElse(null);\n+      }\n+      return null;\n+   }","path":"core/src/main/java/org/infinispan/transaction/impl/AbstractCacheTransaction.java","position":null,"original_position":108,"commit_id":"8fb8c0616562a68a8e13bbdd74fc4ddd631581c2","original_commit_id":"5244deab57def4982933fa789d4d16db6bb3ad76","user":{"login":"wburns","id":648175,"avatar_url":"https://avatars.githubusercontent.com/u/648175?v=3","gravatar_id":"","url":"https://api.github.com/users/wburns","html_url":"https://github.com/wburns","followers_url":"https://api.github.com/users/wburns/followers","following_url":"https://api.github.com/users/wburns/following{/other_user}","gists_url":"https://api.github.com/users/wburns/gists{/gist_id}","starred_url":"https://api.github.com/users/wburns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wburns/subscriptions","organizations_url":"https://api.github.com/users/wburns/orgs","repos_url":"https://api.github.com/users/wburns/repos","events_url":"https://api.github.com/users/wburns/events{/privacy}","received_events_url":"https://api.github.com/users/wburns/received_events","type":"User","site_admin":false},"body":"I can understand that yes.  Also when using iteration, if using an array list we should use for int loops instead as they are also 16% faster.\r\n\r\nAlthough we need to be cognizant of what the alternatives are more than just saying 1 thing is bad imo.  For example iterating over the collection multiple times or creating a new collection could be worse then just using a stream.","created_at":"2015-07-23T17:18:42Z","updated_at":"2015-07-23T17:18:42Z","html_url":"https://github.com/infinispan/infinispan/pull/3594#discussion_r35346598","pull_request_url":"https://api.github.com/repos/infinispan/infinispan/pulls/3594","_links":{"self":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/comments/35346598"},"html":{"href":"https://github.com/infinispan/infinispan/pull/3594#discussion_r35346598"},"pull_request":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/3594"}}},"pull_request":{"url":"https://api.github.com/repos/infinispan/infinispan/pulls/3594","id":40349523,"html_url":"https://github.com/infinispan/infinispan/pull/3594","diff_url":"https://github.com/infinispan/infinispan/pull/3594.diff","patch_url":"https://github.com/infinispan/infinispan/pull/3594.patch","issue_url":"https://api.github.com/repos/infinispan/infinispan/issues/3594","number":3594,"state":"closed","locked":false,"title":"ISPN-5620 Create PendingLockManager","user":{"login":"pruivo","id":1492066,"avatar_url":"https://avatars.githubusercontent.com/u/1492066?v=3","gravatar_id":"","url":"https://api.github.com/users/pruivo","html_url":"https://github.com/pruivo","followers_url":"https://api.github.com/users/pruivo/followers","following_url":"https://api.github.com/users/pruivo/following{/other_user}","gists_url":"https://api.github.com/users/pruivo/gists{/gist_id}","starred_url":"https://api.github.com/users/pruivo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pruivo/subscriptions","organizations_url":"https://api.github.com/users/pruivo/orgs","repos_url":"https://api.github.com/users/pruivo/repos","events_url":"https://api.github.com/users/pruivo/events{/privacy}","received_events_url":"https://api.github.com/users/pruivo/received_events","type":"User","site_admin":false},"body":"https://issues.jboss.org/browse/ISPN-5620\r\n\r\nPendingLockManager will be responsible to check for older topology id transaction that may have locks acquired. Newer transactions would have to wait for them to complete before proceeding in lock acquisition.\r\n","created_at":"2015-07-20T13:06:20Z","updated_at":"2015-07-23T17:18:42Z","closed_at":"2015-07-23T15:47:03Z","merged_at":null,"merge_commit_sha":"c6727f732db0e2c00a832af1b8e067f12afe31f2","assignee":{"login":"danberindei","id":504907,"avatar_url":"https://avatars.githubusercontent.com/u/504907?v=3","gravatar_id":"","url":"https://api.github.com/users/danberindei","html_url":"https://github.com/danberindei","followers_url":"https://api.github.com/users/danberindei/followers","following_url":"https://api.github.com/users/danberindei/following{/other_user}","gists_url":"https://api.github.com/users/danberindei/gists{/gist_id}","starred_url":"https://api.github.com/users/danberindei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danberindei/subscriptions","organizations_url":"https://api.github.com/users/danberindei/orgs","repos_url":"https://api.github.com/users/danberindei/repos","events_url":"https://api.github.com/users/danberindei/events{/privacy}","received_events_url":"https://api.github.com/users/danberindei/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/infinispan/infinispan/pulls/3594/commits","review_comments_url":"https://api.github.com/repos/infinispan/infinispan/pulls/3594/comments","review_comment_url":"https://api.github.com/repos/infinispan/infinispan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/infinispan/infinispan/issues/3594/comments","statuses_url":"https://api.github.com/repos/infinispan/infinispan/statuses/8fb8c0616562a68a8e13bbdd74fc4ddd631581c2","head":{"label":"pruivo:pending_lock_manager","ref":"pending_lock_manager","sha":"8fb8c0616562a68a8e13bbdd74fc4ddd631581c2","user":{"login":"pruivo","id":1492066,"avatar_url":"https://avatars.githubusercontent.com/u/1492066?v=3","gravatar_id":"","url":"https://api.github.com/users/pruivo","html_url":"https://github.com/pruivo","followers_url":"https://api.github.com/users/pruivo/followers","following_url":"https://api.github.com/users/pruivo/following{/other_user}","gists_url":"https://api.github.com/users/pruivo/gists{/gist_id}","starred_url":"https://api.github.com/users/pruivo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pruivo/subscriptions","organizations_url":"https://api.github.com/users/pruivo/orgs","repos_url":"https://api.github.com/users/pruivo/repos","events_url":"https://api.github.com/users/pruivo/events{/privacy}","received_events_url":"https://api.github.com/users/pruivo/received_events","type":"User","site_admin":false},"repo":{"id":3626075,"name":"infinispan","full_name":"pruivo/infinispan","owner":{"login":"pruivo","id":1492066,"avatar_url":"https://avatars.githubusercontent.com/u/1492066?v=3","gravatar_id":"","url":"https://api.github.com/users/pruivo","html_url":"https://github.com/pruivo","followers_url":"https://api.github.com/users/pruivo/followers","following_url":"https://api.github.com/users/pruivo/following{/other_user}","gists_url":"https://api.github.com/users/pruivo/gists{/gist_id}","starred_url":"https://api.github.com/users/pruivo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pruivo/subscriptions","organizations_url":"https://api.github.com/users/pruivo/orgs","repos_url":"https://api.github.com/users/pruivo/repos","events_url":"https://api.github.com/users/pruivo/events{/privacy}","received_events_url":"https://api.github.com/users/pruivo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pruivo/infinispan","description":"Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.","fork":true,"url":"https://api.github.com/repos/pruivo/infinispan","forks_url":"https://api.github.com/repos/pruivo/infinispan/forks","keys_url":"https://api.github.com/repos/pruivo/infinispan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pruivo/infinispan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pruivo/infinispan/teams","hooks_url":"https://api.github.com/repos/pruivo/infinispan/hooks","issue_events_url":"https://api.github.com/repos/pruivo/infinispan/issues/events{/number}","events_url":"https://api.github.com/repos/pruivo/infinispan/events","assignees_url":"https://api.github.com/repos/pruivo/infinispan/assignees{/user}","branches_url":"https://api.github.com/repos/pruivo/infinispan/branches{/branch}","tags_url":"https://api.github.com/repos/pruivo/infinispan/tags","blobs_url":"https://api.github.com/repos/pruivo/infinispan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pruivo/infinispan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pruivo/infinispan/git/refs{/sha}","trees_url":"https://api.github.com/repos/pruivo/infinispan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pruivo/infinispan/statuses/{sha}","languages_url":"https://api.github.com/repos/pruivo/infinispan/languages","stargazers_url":"https://api.github.com/repos/pruivo/infinispan/stargazers","contributors_url":"https://api.github.com/repos/pruivo/infinispan/contributors","subscribers_url":"https://api.github.com/repos/pruivo/infinispan/subscribers","subscription_url":"https://api.github.com/repos/pruivo/infinispan/subscription","commits_url":"https://api.github.com/repos/pruivo/infinispan/commits{/sha}","git_commits_url":"https://api.github.com/repos/pruivo/infinispan/git/commits{/sha}","comments_url":"https://api.github.com/repos/pruivo/infinispan/comments{/number}","issue_comment_url":"https://api.github.com/repos/pruivo/infinispan/issues/comments{/number}","contents_url":"https://api.github.com/repos/pruivo/infinispan/contents/{+path}","compare_url":"https://api.github.com/repos/pruivo/infinispan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pruivo/infinispan/merges","archive_url":"https://api.github.com/repos/pruivo/infinispan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pruivo/infinispan/downloads","issues_url":"https://api.github.com/repos/pruivo/infinispan/issues{/number}","pulls_url":"https://api.github.com/repos/pruivo/infinispan/pulls{/number}","milestones_url":"https://api.github.com/repos/pruivo/infinispan/milestones{/number}","notifications_url":"https://api.github.com/repos/pruivo/infinispan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pruivo/infinispan/labels{/name}","releases_url":"https://api.github.com/repos/pruivo/infinispan/releases{/id}","created_at":"2012-03-05T10:40:21Z","updated_at":"2015-05-08T17:30:13Z","pushed_at":"2015-07-23T13:40:16Z","git_url":"git://github.com/pruivo/infinispan.git","ssh_url":"git@github.com:pruivo/infinispan.git","clone_url":"https://github.com/pruivo/infinispan.git","svn_url":"https://github.com/pruivo/infinispan","homepage":"http://www.infinispan.org","size":77200,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":0,"forks":6,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"infinispan:master","ref":"master","sha":"bf60cbde58e3a82ec536176557fbef096003e7ac","user":{"login":"infinispan","id":458093,"avatar_url":"https://avatars.githubusercontent.com/u/458093?v=3","gravatar_id":"","url":"https://api.github.com/users/infinispan","html_url":"https://github.com/infinispan","followers_url":"https://api.github.com/users/infinispan/followers","following_url":"https://api.github.com/users/infinispan/following{/other_user}","gists_url":"https://api.github.com/users/infinispan/gists{/gist_id}","starred_url":"https://api.github.com/users/infinispan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infinispan/subscriptions","organizations_url":"https://api.github.com/users/infinispan/orgs","repos_url":"https://api.github.com/users/infinispan/repos","events_url":"https://api.github.com/users/infinispan/events{/privacy}","received_events_url":"https://api.github.com/users/infinispan/received_events","type":"Organization","site_admin":false},"repo":{"id":1050944,"name":"infinispan","full_name":"infinispan/infinispan","owner":{"login":"infinispan","id":458093,"avatar_url":"https://avatars.githubusercontent.com/u/458093?v=3","gravatar_id":"","url":"https://api.github.com/users/infinispan","html_url":"https://github.com/infinispan","followers_url":"https://api.github.com/users/infinispan/followers","following_url":"https://api.github.com/users/infinispan/following{/other_user}","gists_url":"https://api.github.com/users/infinispan/gists{/gist_id}","starred_url":"https://api.github.com/users/infinispan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/infinispan/subscriptions","organizations_url":"https://api.github.com/users/infinispan/orgs","repos_url":"https://api.github.com/users/infinispan/repos","events_url":"https://api.github.com/users/infinispan/events{/privacy}","received_events_url":"https://api.github.com/users/infinispan/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/infinispan/infinispan","description":"Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.","fork":false,"url":"https://api.github.com/repos/infinispan/infinispan","forks_url":"https://api.github.com/repos/infinispan/infinispan/forks","keys_url":"https://api.github.com/repos/infinispan/infinispan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/infinispan/infinispan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/infinispan/infinispan/teams","hooks_url":"https://api.github.com/repos/infinispan/infinispan/hooks","issue_events_url":"https://api.github.com/repos/infinispan/infinispan/issues/events{/number}","events_url":"https://api.github.com/repos/infinispan/infinispan/events","assignees_url":"https://api.github.com/repos/infinispan/infinispan/assignees{/user}","branches_url":"https://api.github.com/repos/infinispan/infinispan/branches{/branch}","tags_url":"https://api.github.com/repos/infinispan/infinispan/tags","blobs_url":"https://api.github.com/repos/infinispan/infinispan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/infinispan/infinispan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/infinispan/infinispan/git/refs{/sha}","trees_url":"https://api.github.com/repos/infinispan/infinispan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/infinispan/infinispan/statuses/{sha}","languages_url":"https://api.github.com/repos/infinispan/infinispan/languages","stargazers_url":"https://api.github.com/repos/infinispan/infinispan/stargazers","contributors_url":"https://api.github.com/repos/infinispan/infinispan/contributors","subscribers_url":"https://api.github.com/repos/infinispan/infinispan/subscribers","subscription_url":"https://api.github.com/repos/infinispan/infinispan/subscription","commits_url":"https://api.github.com/repos/infinispan/infinispan/commits{/sha}","git_commits_url":"https://api.github.com/repos/infinispan/infinispan/git/commits{/sha}","comments_url":"https://api.github.com/repos/infinispan/infinispan/comments{/number}","issue_comment_url":"https://api.github.com/repos/infinispan/infinispan/issues/comments{/number}","contents_url":"https://api.github.com/repos/infinispan/infinispan/contents/{+path}","compare_url":"https://api.github.com/repos/infinispan/infinispan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/infinispan/infinispan/merges","archive_url":"https://api.github.com/repos/infinispan/infinispan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/infinispan/infinispan/downloads","issues_url":"https://api.github.com/repos/infinispan/infinispan/issues{/number}","pulls_url":"https://api.github.com/repos/infinispan/infinispan/pulls{/number}","milestones_url":"https://api.github.com/repos/infinispan/infinispan/milestones{/number}","notifications_url":"https://api.github.com/repos/infinispan/infinispan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/infinispan/infinispan/labels{/name}","releases_url":"https://api.github.com/repos/infinispan/infinispan/releases{/id}","created_at":"2010-11-04T12:33:19Z","updated_at":"2015-07-20T20:05:17Z","pushed_at":"2015-07-23T16:40:26Z","git_url":"git://github.com/infinispan/infinispan.git","ssh_url":"git@github.com:infinispan/infinispan.git","clone_url":"https://github.com/infinispan/infinispan.git","svn_url":"https://github.com/infinispan/infinispan","homepage":"http://www.infinispan.org","size":155301,"stargazers_count":389,"watchers_count":389,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":296,"mirror_url":null,"open_issues_count":14,"forks":296,"open_issues":14,"watchers":389,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/3594"},"html":{"href":"https://github.com/infinispan/infinispan/pull/3594"},"issue":{"href":"https://api.github.com/repos/infinispan/infinispan/issues/3594"},"comments":{"href":"https://api.github.com/repos/infinispan/infinispan/issues/3594/comments"},"review_comments":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/3594/comments"},"review_comment":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/infinispan/infinispan/pulls/3594/commits"},"statuses":{"href":"https://api.github.com/repos/infinispan/infinispan/statuses/8fb8c0616562a68a8e13bbdd74fc4ddd631581c2"}}}}