{"action":"created","comment":{"url":"https://api.github.com/repos/strongbox/strongbox/pulls/comments/204953875","pull_request_review_id":140129255,"id":204953875,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDk1Mzg3NQ==","diff_hunk":"@@ -0,0 +1,113 @@\n+package org.carlspring.strongbox.artifact;\n+\n+import java.io.IOException;\n+import java.lang.reflect.UndeclaredThrowableException;\n+import java.util.concurrent.locks.ReadWriteLock;\n+\n+import javax.inject.Inject;\n+\n+import org.carlspring.strongbox.domain.ArtifactEntry;\n+import org.carlspring.strongbox.event.AsyncEventListener;\n+import org.carlspring.strongbox.event.artifact.ArtifactEvent;\n+import org.carlspring.strongbox.event.artifact.ArtifactEventTypeEnum;\n+import org.carlspring.strongbox.providers.io.RepositoryFiles;\n+import org.carlspring.strongbox.providers.io.RepositoryPath;\n+import org.carlspring.strongbox.providers.io.RepositoryPathLock;\n+import org.carlspring.strongbox.services.ArtifactEntryService;\n+import org.springframework.transaction.PlatformTransactionManager;\n+import org.springframework.transaction.support.TransactionTemplate;\n+\n+public abstract class AsyncArtifactEntryHandler\n+{\n+\n+    @Inject\n+    private ArtifactEntryService artifactEntryService;\n+\n+    @Inject\n+    private RepositoryPathLock repositoryPathLock;\n+\n+    @Inject\n+    private PlatformTransactionManager transactionManager;\n+\n+    private final ArtifactEventTypeEnum eventType;\n+\n+    public AsyncArtifactEntryHandler(ArtifactEventTypeEnum eventType)\n+    {\n+        super();\n+        this.eventType = eventType;\n+    }\n+\n+    @AsyncEventListener\n+    public void handleEvent(final ArtifactEvent<RepositoryPath> event)\n+        throws IOException,\n+        InterruptedException\n+    {\n+        if (eventType.getType() != event.getType())\n+        {\n+            return;\n+        }\n+\n+        RepositoryPath repositoryPath = (RepositoryPath) event.getPath();\n+        if (!RepositoryFiles.isArtifact(repositoryPath))\n+        {\n+            return;\n+        }\n+\n+        // TODO: please don't panic, this is needed just as workadound to have\n+        // new transaction within this async event (expected to be replaced with\n+        // just Propagation.REQUIRES_NEW after SB-1200)\n+        Object sync = new Object();\n+        new Thread(() -> {\n+            try\n+            {\n+                handleLocked(repositoryPath);\n+            }\n+            finally\n+            {\n+                synchronized (sync)\n+                {\n+                    sync.notifyAll();\n+                }\n+            }\n+        }).start();\n+\n+        synchronized (sync)\n+        {\n+            sync.wait();","path":"strongbox-storage/strongbox-storage-api/src/main/java/org/carlspring/strongbox/artifact/AsyncArtifactEntryHandler.java","position":76,"original_position":76,"commit_id":"736bcd98f256f68195a111f4aa03c66426de3f6b","original_commit_id":"736bcd98f256f68195a111f4aa03c66426de3f6b","user":{"login":"cs-devops-bot","id":20419677,"node_id":"MDQ6VXNlcjIwNDE5Njc3","avatar_url":"https://avatars3.githubusercontent.com/u/20419677?v=4","gravatar_id":"","url":"https://api.github.com/users/cs-devops-bot","html_url":"https://github.com/cs-devops-bot","followers_url":"https://api.github.com/users/cs-devops-bot/followers","following_url":"https://api.github.com/users/cs-devops-bot/following{/other_user}","gists_url":"https://api.github.com/users/cs-devops-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/cs-devops-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs-devops-bot/subscriptions","organizations_url":"https://api.github.com/users/cs-devops-bot/orgs","repos_url":"https://api.github.com/users/cs-devops-bot/repos","events_url":"https://api.github.com/users/cs-devops-bot/events{/privacy}","received_events_url":"https://api.github.com/users/cs-devops-bot/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://sonarsource.github.io/sonar-github/severity-major.png 'Severity: MAJOR') Unconditional wait in org.carlspring.strongbox.artifact.AsyncArtifactEntryHandler.handleEvent(ArtifactEvent) [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://dev.carlspring.org/sonar/coding_rules#rule_key=findbugs%3AUW_UNCOND_WAIT)\n![MAJOR](https://sonarsource.github.io/sonar-github/severity-major.png 'Severity: MAJOR') Wait not in loop in org.carlspring.strongbox.artifact.AsyncArtifactEntryHandler.handleEvent(ArtifactEvent) [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://dev.carlspring.org/sonar/coding_rules#rule_key=findbugs%3AWA_NOT_IN_LOOP)\n","created_at":"2018-07-25T00:46:42Z","updated_at":"2018-07-25T00:46:42Z","html_url":"https://github.com/strongbox/strongbox/pull/753#discussion_r204953875","pull_request_url":"https://api.github.com/repos/strongbox/strongbox/pulls/753","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/comments/204953875"},"html":{"href":"https://github.com/strongbox/strongbox/pull/753#discussion_r204953875"},"pull_request":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/753"}}},"pull_request":{"url":"https://api.github.com/repos/strongbox/strongbox/pulls/753","id":201530428,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNTMwNDI4","html_url":"https://github.com/strongbox/strongbox/pull/753","diff_url":"https://github.com/strongbox/strongbox/pull/753.diff","patch_url":"https://github.com/strongbox/strongbox/pull/753.patch","issue_url":"https://api.github.com/repos/strongbox/strongbox/issues/753","number":753,"state":"open","locked":false,"title":"SB-1183: ArtifactEntry update fixed for reading artifacts [ready]","user":{"login":"sbespalov","id":22783811,"node_id":"MDQ6VXNlcjIyNzgzODEx","avatar_url":"https://avatars2.githubusercontent.com/u/22783811?v=4","gravatar_id":"","url":"https://api.github.com/users/sbespalov","html_url":"https://github.com/sbespalov","followers_url":"https://api.github.com/users/sbespalov/followers","following_url":"https://api.github.com/users/sbespalov/following{/other_user}","gists_url":"https://api.github.com/users/sbespalov/gists{/gist_id}","starred_url":"https://api.github.com/users/sbespalov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbespalov/subscriptions","organizations_url":"https://api.github.com/users/sbespalov/orgs","repos_url":"https://api.github.com/users/sbespalov/repos","events_url":"https://api.github.com/users/sbespalov/events{/privacy}","received_events_url":"https://api.github.com/users/sbespalov/received_events","type":"User","site_admin":false},"body":"- ArtifactEntry lock fixed with Hazelcast\r\n- Distributed read/write lock used for artifacts download/upload\r\n- RepositoryInput/OutputStream improved with `RepositoryStreamSupport` class","created_at":"2018-07-16T02:37:37Z","updated_at":"2018-07-25T00:46:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64cbd5196473873d4c1c892fc9854a7007a5006f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/strongbox/strongbox/pulls/753/commits","review_comments_url":"https://api.github.com/repos/strongbox/strongbox/pulls/753/comments","review_comment_url":"https://api.github.com/repos/strongbox/strongbox/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strongbox/strongbox/issues/753/comments","statuses_url":"https://api.github.com/repos/strongbox/strongbox/statuses/736bcd98f256f68195a111f4aa03c66426de3f6b","head":{"label":"sbespalov:sbespalov_SB-1183","ref":"sbespalov_SB-1183","sha":"736bcd98f256f68195a111f4aa03c66426de3f6b","user":{"login":"sbespalov","id":22783811,"node_id":"MDQ6VXNlcjIyNzgzODEx","avatar_url":"https://avatars2.githubusercontent.com/u/22783811?v=4","gravatar_id":"","url":"https://api.github.com/users/sbespalov","html_url":"https://github.com/sbespalov","followers_url":"https://api.github.com/users/sbespalov/followers","following_url":"https://api.github.com/users/sbespalov/following{/other_user}","gists_url":"https://api.github.com/users/sbespalov/gists{/gist_id}","starred_url":"https://api.github.com/users/sbespalov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbespalov/subscriptions","organizations_url":"https://api.github.com/users/sbespalov/orgs","repos_url":"https://api.github.com/users/sbespalov/repos","events_url":"https://api.github.com/users/sbespalov/events{/privacy}","received_events_url":"https://api.github.com/users/sbespalov/received_events","type":"User","site_admin":false},"repo":{"id":72494340,"node_id":"MDEwOlJlcG9zaXRvcnk3MjQ5NDM0MA==","name":"strongbox","full_name":"sbespalov/strongbox","owner":{"login":"sbespalov","id":22783811,"node_id":"MDQ6VXNlcjIyNzgzODEx","avatar_url":"https://avatars2.githubusercontent.com/u/22783811?v=4","gravatar_id":"","url":"https://api.github.com/users/sbespalov","html_url":"https://github.com/sbespalov","followers_url":"https://api.github.com/users/sbespalov/followers","following_url":"https://api.github.com/users/sbespalov/following{/other_user}","gists_url":"https://api.github.com/users/sbespalov/gists{/gist_id}","starred_url":"https://api.github.com/users/sbespalov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbespalov/subscriptions","organizations_url":"https://api.github.com/users/sbespalov/orgs","repos_url":"https://api.github.com/users/sbespalov/repos","events_url":"https://api.github.com/users/sbespalov/events{/privacy}","received_events_url":"https://api.github.com/users/sbespalov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sbespalov/strongbox","description":null,"fork":true,"url":"https://api.github.com/repos/sbespalov/strongbox","forks_url":"https://api.github.com/repos/sbespalov/strongbox/forks","keys_url":"https://api.github.com/repos/sbespalov/strongbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sbespalov/strongbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sbespalov/strongbox/teams","hooks_url":"https://api.github.com/repos/sbespalov/strongbox/hooks","issue_events_url":"https://api.github.com/repos/sbespalov/strongbox/issues/events{/number}","events_url":"https://api.github.com/repos/sbespalov/strongbox/events","assignees_url":"https://api.github.com/repos/sbespalov/strongbox/assignees{/user}","branches_url":"https://api.github.com/repos/sbespalov/strongbox/branches{/branch}","tags_url":"https://api.github.com/repos/sbespalov/strongbox/tags","blobs_url":"https://api.github.com/repos/sbespalov/strongbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sbespalov/strongbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sbespalov/strongbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/sbespalov/strongbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sbespalov/strongbox/statuses/{sha}","languages_url":"https://api.github.com/repos/sbespalov/strongbox/languages","stargazers_url":"https://api.github.com/repos/sbespalov/strongbox/stargazers","contributors_url":"https://api.github.com/repos/sbespalov/strongbox/contributors","subscribers_url":"https://api.github.com/repos/sbespalov/strongbox/subscribers","subscription_url":"https://api.github.com/repos/sbespalov/strongbox/subscription","commits_url":"https://api.github.com/repos/sbespalov/strongbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/sbespalov/strongbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/sbespalov/strongbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/sbespalov/strongbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/sbespalov/strongbox/contents/{+path}","compare_url":"https://api.github.com/repos/sbespalov/strongbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sbespalov/strongbox/merges","archive_url":"https://api.github.com/repos/sbespalov/strongbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sbespalov/strongbox/downloads","issues_url":"https://api.github.com/repos/sbespalov/strongbox/issues{/number}","pulls_url":"https://api.github.com/repos/sbespalov/strongbox/pulls{/number}","milestones_url":"https://api.github.com/repos/sbespalov/strongbox/milestones{/number}","notifications_url":"https://api.github.com/repos/sbespalov/strongbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sbespalov/strongbox/labels{/name}","releases_url":"https://api.github.com/repos/sbespalov/strongbox/releases{/id}","deployments_url":"https://api.github.com/repos/sbespalov/strongbox/deployments","created_at":"2016-11-01T01:54:58Z","updated_at":"2018-07-14T14:45:57Z","pushed_at":"2018-07-25T00:23:54Z","git_url":"git://github.com/sbespalov/strongbox.git","ssh_url":"git@github.com:sbespalov/strongbox.git","clone_url":"https://github.com/sbespalov/strongbox.git","svn_url":"https://github.com/sbespalov/strongbox","homepage":null,"size":9902,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"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","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"strongbox:master","ref":"master","sha":"cf26fe5e12fe90cf5e809b0dec5e6b54bec5d902","user":{"login":"strongbox","id":5637881,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2Mzc4ODE=","avatar_url":"https://avatars0.githubusercontent.com/u/5637881?v=4","gravatar_id":"","url":"https://api.github.com/users/strongbox","html_url":"https://github.com/strongbox","followers_url":"https://api.github.com/users/strongbox/followers","following_url":"https://api.github.com/users/strongbox/following{/other_user}","gists_url":"https://api.github.com/users/strongbox/gists{/gist_id}","starred_url":"https://api.github.com/users/strongbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongbox/subscriptions","organizations_url":"https://api.github.com/users/strongbox/orgs","repos_url":"https://api.github.com/users/strongbox/repos","events_url":"https://api.github.com/users/strongbox/events{/privacy}","received_events_url":"https://api.github.com/users/strongbox/received_events","type":"Organization","site_admin":false},"repo":{"id":11830269,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgzMDI2OQ==","name":"strongbox","full_name":"strongbox/strongbox","owner":{"login":"strongbox","id":5637881,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2Mzc4ODE=","avatar_url":"https://avatars0.githubusercontent.com/u/5637881?v=4","gravatar_id":"","url":"https://api.github.com/users/strongbox","html_url":"https://github.com/strongbox","followers_url":"https://api.github.com/users/strongbox/followers","following_url":"https://api.github.com/users/strongbox/following{/other_user}","gists_url":"https://api.github.com/users/strongbox/gists{/gist_id}","starred_url":"https://api.github.com/users/strongbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongbox/subscriptions","organizations_url":"https://api.github.com/users/strongbox/orgs","repos_url":"https://api.github.com/users/strongbox/repos","events_url":"https://api.github.com/users/strongbox/events{/privacy}","received_events_url":"https://api.github.com/users/strongbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongbox/strongbox","description":"Strongbox is an artifact repository manager.","fork":false,"url":"https://api.github.com/repos/strongbox/strongbox","forks_url":"https://api.github.com/repos/strongbox/strongbox/forks","keys_url":"https://api.github.com/repos/strongbox/strongbox/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongbox/strongbox/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongbox/strongbox/teams","hooks_url":"https://api.github.com/repos/strongbox/strongbox/hooks","issue_events_url":"https://api.github.com/repos/strongbox/strongbox/issues/events{/number}","events_url":"https://api.github.com/repos/strongbox/strongbox/events","assignees_url":"https://api.github.com/repos/strongbox/strongbox/assignees{/user}","branches_url":"https://api.github.com/repos/strongbox/strongbox/branches{/branch}","tags_url":"https://api.github.com/repos/strongbox/strongbox/tags","blobs_url":"https://api.github.com/repos/strongbox/strongbox/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongbox/strongbox/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongbox/strongbox/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongbox/strongbox/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongbox/strongbox/statuses/{sha}","languages_url":"https://api.github.com/repos/strongbox/strongbox/languages","stargazers_url":"https://api.github.com/repos/strongbox/strongbox/stargazers","contributors_url":"https://api.github.com/repos/strongbox/strongbox/contributors","subscribers_url":"https://api.github.com/repos/strongbox/strongbox/subscribers","subscription_url":"https://api.github.com/repos/strongbox/strongbox/subscription","commits_url":"https://api.github.com/repos/strongbox/strongbox/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongbox/strongbox/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongbox/strongbox/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongbox/strongbox/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongbox/strongbox/contents/{+path}","compare_url":"https://api.github.com/repos/strongbox/strongbox/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongbox/strongbox/merges","archive_url":"https://api.github.com/repos/strongbox/strongbox/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongbox/strongbox/downloads","issues_url":"https://api.github.com/repos/strongbox/strongbox/issues{/number}","pulls_url":"https://api.github.com/repos/strongbox/strongbox/pulls{/number}","milestones_url":"https://api.github.com/repos/strongbox/strongbox/milestones{/number}","notifications_url":"https://api.github.com/repos/strongbox/strongbox/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongbox/strongbox/labels{/name}","releases_url":"https://api.github.com/repos/strongbox/strongbox/releases{/id}","deployments_url":"https://api.github.com/repos/strongbox/strongbox/deployments","created_at":"2013-08-01T23:27:37Z","updated_at":"2018-07-23T17:03:48Z","pushed_at":"2018-07-25T00:23:56Z","git_url":"git://github.com/strongbox/strongbox.git","ssh_url":"git@github.com:strongbox/strongbox.git","clone_url":"https://github.com/strongbox/strongbox.git","svn_url":"https://github.com/strongbox/strongbox","homepage":"","size":9765,"stargazers_count":38,"watchers_count":38,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":54,"mirror_url":null,"archived":false,"open_issues_count":49,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":54,"open_issues":49,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/753"},"html":{"href":"https://github.com/strongbox/strongbox/pull/753"},"issue":{"href":"https://api.github.com/repos/strongbox/strongbox/issues/753"},"comments":{"href":"https://api.github.com/repos/strongbox/strongbox/issues/753/comments"},"review_comments":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/753/comments"},"review_comment":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strongbox/strongbox/pulls/753/commits"},"statuses":{"href":"https://api.github.com/repos/strongbox/strongbox/statuses/736bcd98f256f68195a111f4aa03c66426de3f6b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"cs-devops-bot"}}