{"action":"created","comment":{"url":"https://api.github.com/repos/spockframework/spock/pulls/comments/46957405","id":46957405,"diff_hunk":"@@ -0,0 +1,67 @@\n+package org.spockframework.runtime;\n+\n+import org.junit.runners.model.RunnerScheduler;\n+\n+import java.util.concurrent.Semaphore;\n+import java.util.concurrent.atomic.AtomicInteger;\n+\n+public class Scheduler {\n+  private final RunnerScheduler runnerScheduler;\n+  private final boolean forceSequential;\n+  private final AtomicInteger scheduledTasksCount = new AtomicInteger(0);\n+  private final Semaphore concurrentJobsSemaphore = new Semaphore(0);\n+  private State state = State.SCHEDULING;\n+\n+  public Scheduler(RunnerScheduler runnerScheduler, boolean forceSequential) {\n+    this.runnerScheduler = runnerScheduler;\n+    this.forceSequential = forceSequential;\n+  }\n+\n+  public void schedule(final Runnable task) {\n+    synchronized (this){","path":"spock-core/src/main/java/org/spockframework/runtime/Scheduler.java","position":21,"original_position":21,"commit_id":"ca64217f3c6b2ba6e8e439929997cf8342385f24","original_commit_id":"109948bacddd94d3063ac968847bd6593007a1a6","user":{"login":"leonard84","id":1151511,"avatar_url":"https://avatars.githubusercontent.com/u/1151511?v=3","gravatar_id":"","url":"https://api.github.com/users/leonard84","html_url":"https://github.com/leonard84","followers_url":"https://api.github.com/users/leonard84/followers","following_url":"https://api.github.com/users/leonard84/following{/other_user}","gists_url":"https://api.github.com/users/leonard84/gists{/gist_id}","starred_url":"https://api.github.com/users/leonard84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonard84/subscriptions","organizations_url":"https://api.github.com/users/leonard84/orgs","repos_url":"https://api.github.com/users/leonard84/repos","events_url":"https://api.github.com/users/leonard84/events{/privacy}","received_events_url":"https://api.github.com/users/leonard84/received_events","type":"User","site_admin":false},"body":"Can we use a more efficient construct than `synchronized`, e.g. ReadWriteLock. Either way you should not use `this` for synchronized, but a private `Object lock = new Object()` to prevent external parties to use your lock.","created_at":"2015-12-08T14:20:24Z","updated_at":"2015-12-08T14:20:24Z","html_url":"https://github.com/spockframework/spock/pull/558#discussion_r46957405","pull_request_url":"https://api.github.com/repos/spockframework/spock/pulls/558","_links":{"self":{"href":"https://api.github.com/repos/spockframework/spock/pulls/comments/46957405"},"html":{"href":"https://github.com/spockframework/spock/pull/558#discussion_r46957405"},"pull_request":{"href":"https://api.github.com/repos/spockframework/spock/pulls/558"}}},"pull_request":{"url":"https://api.github.com/repos/spockframework/spock/pulls/558","id":52754826,"html_url":"https://github.com/spockframework/spock/pull/558","diff_url":"https://github.com/spockframework/spock/pull/558.diff","patch_url":"https://github.com/spockframework/spock/pull/558.patch","issue_url":"https://api.github.com/repos/spockframework/spock/issues/558","number":558,"state":"open","locked":false,"title":"Support for parallel feature and iteration execution","user":{"login":"Fuud","id":283980,"avatar_url":"https://avatars.githubusercontent.com/u/283980?v=3","gravatar_id":"","url":"https://api.github.com/users/Fuud","html_url":"https://github.com/Fuud","followers_url":"https://api.github.com/users/Fuud/followers","following_url":"https://api.github.com/users/Fuud/following{/other_user}","gists_url":"https://api.github.com/users/Fuud/gists{/gist_id}","starred_url":"https://api.github.com/users/Fuud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fuud/subscriptions","organizations_url":"https://api.github.com/users/Fuud/orgs","repos_url":"https://api.github.com/users/Fuud/repos","events_url":"https://api.github.com/users/Fuud/events{/privacy}","received_events_url":"https://api.github.com/users/Fuud/received_events","type":"User","site_admin":false},"body":"This is clone of #67, rebased on spockframework/master.\r\nDifference to #67:\r\n1) Added test `AllTestsInParallelTest.\"all spock-spec tests in parallel mode\"`. This test runs most tests under org.spockframework package with concurrent sheduler.\r\n2) Several tests was rewritten to support concurrent execution of tests and iterations.\r\n3) MockInstantiator now uses ObjenesisStd without cache (cache works only by class name and therefore prevents mocking classes with same name but different classloaders)\r\n4) Timeouts in TimeoutExtension spec was enlarged to support slower execution of individual test in concurrent mode.","created_at":"2015-12-05T13:16:49Z","updated_at":"2015-12-08T14:20:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8ab8fe81974a4e2e6e6d8749742842d98bc6cda0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/spockframework/spock/pulls/558/commits","review_comments_url":"https://api.github.com/repos/spockframework/spock/pulls/558/comments","review_comment_url":"https://api.github.com/repos/spockframework/spock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spockframework/spock/issues/558/comments","statuses_url":"https://api.github.com/repos/spockframework/spock/statuses/ca64217f3c6b2ba6e8e439929997cf8342385f24","head":{"label":"Fuud:parallel__over_spock_master","ref":"parallel__over_spock_master","sha":"ca64217f3c6b2ba6e8e439929997cf8342385f24","user":{"login":"Fuud","id":283980,"avatar_url":"https://avatars.githubusercontent.com/u/283980?v=3","gravatar_id":"","url":"https://api.github.com/users/Fuud","html_url":"https://github.com/Fuud","followers_url":"https://api.github.com/users/Fuud/followers","following_url":"https://api.github.com/users/Fuud/following{/other_user}","gists_url":"https://api.github.com/users/Fuud/gists{/gist_id}","starred_url":"https://api.github.com/users/Fuud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fuud/subscriptions","organizations_url":"https://api.github.com/users/Fuud/orgs","repos_url":"https://api.github.com/users/Fuud/repos","events_url":"https://api.github.com/users/Fuud/events{/privacy}","received_events_url":"https://api.github.com/users/Fuud/received_events","type":"User","site_admin":false},"repo":{"id":23491035,"name":"spock","full_name":"Fuud/spock","owner":{"login":"Fuud","id":283980,"avatar_url":"https://avatars.githubusercontent.com/u/283980?v=3","gravatar_id":"","url":"https://api.github.com/users/Fuud","html_url":"https://github.com/Fuud","followers_url":"https://api.github.com/users/Fuud/followers","following_url":"https://api.github.com/users/Fuud/following{/other_user}","gists_url":"https://api.github.com/users/Fuud/gists{/gist_id}","starred_url":"https://api.github.com/users/Fuud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fuud/subscriptions","organizations_url":"https://api.github.com/users/Fuud/orgs","repos_url":"https://api.github.com/users/Fuud/repos","events_url":"https://api.github.com/users/Fuud/events{/privacy}","received_events_url":"https://api.github.com/users/Fuud/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Fuud/spock","description":"The Enterprise-ready testing and specification framework.","fork":true,"url":"https://api.github.com/repos/Fuud/spock","forks_url":"https://api.github.com/repos/Fuud/spock/forks","keys_url":"https://api.github.com/repos/Fuud/spock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Fuud/spock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Fuud/spock/teams","hooks_url":"https://api.github.com/repos/Fuud/spock/hooks","issue_events_url":"https://api.github.com/repos/Fuud/spock/issues/events{/number}","events_url":"https://api.github.com/repos/Fuud/spock/events","assignees_url":"https://api.github.com/repos/Fuud/spock/assignees{/user}","branches_url":"https://api.github.com/repos/Fuud/spock/branches{/branch}","tags_url":"https://api.github.com/repos/Fuud/spock/tags","blobs_url":"https://api.github.com/repos/Fuud/spock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Fuud/spock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Fuud/spock/git/refs{/sha}","trees_url":"https://api.github.com/repos/Fuud/spock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Fuud/spock/statuses/{sha}","languages_url":"https://api.github.com/repos/Fuud/spock/languages","stargazers_url":"https://api.github.com/repos/Fuud/spock/stargazers","contributors_url":"https://api.github.com/repos/Fuud/spock/contributors","subscribers_url":"https://api.github.com/repos/Fuud/spock/subscribers","subscription_url":"https://api.github.com/repos/Fuud/spock/subscription","commits_url":"https://api.github.com/repos/Fuud/spock/commits{/sha}","git_commits_url":"https://api.github.com/repos/Fuud/spock/git/commits{/sha}","comments_url":"https://api.github.com/repos/Fuud/spock/comments{/number}","issue_comment_url":"https://api.github.com/repos/Fuud/spock/issues/comments{/number}","contents_url":"https://api.github.com/repos/Fuud/spock/contents/{+path}","compare_url":"https://api.github.com/repos/Fuud/spock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Fuud/spock/merges","archive_url":"https://api.github.com/repos/Fuud/spock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Fuud/spock/downloads","issues_url":"https://api.github.com/repos/Fuud/spock/issues{/number}","pulls_url":"https://api.github.com/repos/Fuud/spock/pulls{/number}","milestones_url":"https://api.github.com/repos/Fuud/spock/milestones{/number}","notifications_url":"https://api.github.com/repos/Fuud/spock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Fuud/spock/labels{/name}","releases_url":"https://api.github.com/repos/Fuud/spock/releases{/id}","created_at":"2014-08-30T12:12:32Z","updated_at":"2014-08-30T15:35:43Z","pushed_at":"2015-12-08T14:14:26Z","git_url":"git://github.com/Fuud/spock.git","ssh_url":"git@github.com:Fuud/spock.git","clone_url":"https://github.com/Fuud/spock.git","svn_url":"https://github.com/Fuud/spock","homepage":"http://spockframework.org","size":8815,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"groovy-1.8"}},"base":{"label":"spockframework:master","ref":"master","sha":"3ebe0520c478011d2f6f8826938a7c24218eb7ba","user":{"login":"spockframework","id":297723,"avatar_url":"https://avatars.githubusercontent.com/u/297723?v=3","gravatar_id":"","url":"https://api.github.com/users/spockframework","html_url":"https://github.com/spockframework","followers_url":"https://api.github.com/users/spockframework/followers","following_url":"https://api.github.com/users/spockframework/following{/other_user}","gists_url":"https://api.github.com/users/spockframework/gists{/gist_id}","starred_url":"https://api.github.com/users/spockframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spockframework/subscriptions","organizations_url":"https://api.github.com/users/spockframework/orgs","repos_url":"https://api.github.com/users/spockframework/repos","events_url":"https://api.github.com/users/spockframework/events{/privacy}","received_events_url":"https://api.github.com/users/spockframework/received_events","type":"Organization","site_admin":false},"repo":{"id":1161862,"name":"spock","full_name":"spockframework/spock","owner":{"login":"spockframework","id":297723,"avatar_url":"https://avatars.githubusercontent.com/u/297723?v=3","gravatar_id":"","url":"https://api.github.com/users/spockframework","html_url":"https://github.com/spockframework","followers_url":"https://api.github.com/users/spockframework/followers","following_url":"https://api.github.com/users/spockframework/following{/other_user}","gists_url":"https://api.github.com/users/spockframework/gists{/gist_id}","starred_url":"https://api.github.com/users/spockframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spockframework/subscriptions","organizations_url":"https://api.github.com/users/spockframework/orgs","repos_url":"https://api.github.com/users/spockframework/repos","events_url":"https://api.github.com/users/spockframework/events{/privacy}","received_events_url":"https://api.github.com/users/spockframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spockframework/spock","description":"The Enterprise-ready testing and specification framework.","fork":false,"url":"https://api.github.com/repos/spockframework/spock","forks_url":"https://api.github.com/repos/spockframework/spock/forks","keys_url":"https://api.github.com/repos/spockframework/spock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spockframework/spock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spockframework/spock/teams","hooks_url":"https://api.github.com/repos/spockframework/spock/hooks","issue_events_url":"https://api.github.com/repos/spockframework/spock/issues/events{/number}","events_url":"https://api.github.com/repos/spockframework/spock/events","assignees_url":"https://api.github.com/repos/spockframework/spock/assignees{/user}","branches_url":"https://api.github.com/repos/spockframework/spock/branches{/branch}","tags_url":"https://api.github.com/repos/spockframework/spock/tags","blobs_url":"https://api.github.com/repos/spockframework/spock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spockframework/spock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spockframework/spock/git/refs{/sha}","trees_url":"https://api.github.com/repos/spockframework/spock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spockframework/spock/statuses/{sha}","languages_url":"https://api.github.com/repos/spockframework/spock/languages","stargazers_url":"https://api.github.com/repos/spockframework/spock/stargazers","contributors_url":"https://api.github.com/repos/spockframework/spock/contributors","subscribers_url":"https://api.github.com/repos/spockframework/spock/subscribers","subscription_url":"https://api.github.com/repos/spockframework/spock/subscription","commits_url":"https://api.github.com/repos/spockframework/spock/commits{/sha}","git_commits_url":"https://api.github.com/repos/spockframework/spock/git/commits{/sha}","comments_url":"https://api.github.com/repos/spockframework/spock/comments{/number}","issue_comment_url":"https://api.github.com/repos/spockframework/spock/issues/comments{/number}","contents_url":"https://api.github.com/repos/spockframework/spock/contents/{+path}","compare_url":"https://api.github.com/repos/spockframework/spock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spockframework/spock/merges","archive_url":"https://api.github.com/repos/spockframework/spock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spockframework/spock/downloads","issues_url":"https://api.github.com/repos/spockframework/spock/issues{/number}","pulls_url":"https://api.github.com/repos/spockframework/spock/pulls{/number}","milestones_url":"https://api.github.com/repos/spockframework/spock/milestones{/number}","notifications_url":"https://api.github.com/repos/spockframework/spock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spockframework/spock/labels{/name}","releases_url":"https://api.github.com/repos/spockframework/spock/releases{/id}","created_at":"2010-12-12T19:02:34Z","updated_at":"2015-12-08T12:07:12Z","pushed_at":"2015-12-08T14:14:27Z","git_url":"git://github.com/spockframework/spock.git","ssh_url":"git@github.com:spockframework/spock.git","clone_url":"https://github.com/spockframework/spock.git","svn_url":"https://github.com/spockframework/spock","homepage":"http://spockframework.org","size":16438,"stargazers_count":879,"watchers_count":879,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":171,"mirror_url":null,"open_issues_count":179,"forks":171,"open_issues":179,"watchers":879,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spockframework/spock/pulls/558"},"html":{"href":"https://github.com/spockframework/spock/pull/558"},"issue":{"href":"https://api.github.com/repos/spockframework/spock/issues/558"},"comments":{"href":"https://api.github.com/repos/spockframework/spock/issues/558/comments"},"review_comments":{"href":"https://api.github.com/repos/spockframework/spock/pulls/558/comments"},"review_comment":{"href":"https://api.github.com/repos/spockframework/spock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spockframework/spock/pulls/558/commits"},"statuses":{"href":"https://api.github.com/repos/spockframework/spock/statuses/ca64217f3c6b2ba6e8e439929997cf8342385f24"}}}}