{"action":"created","comment":{"url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/comments/68159516","id":68159516,"diff_hunk":"@@ -0,0 +1,78 @@\n+﻿using System;\n+using System.Threading;\n+using Akka.Event;\n+using Akka.Util;\n+\n+namespace Akka.Dispatch\n+{\n+    /// <summary>\n+    /// The event-based <see cref=\"Dispatcher\"/> binds a set of actors to a thread pool backed up\n+    /// by a thread-safe queue.\n+    /// \n+    /// The preferred way of creating dispatchers is to define them in configuration and use the \n+    /// <see cref=\"Dispatchers.Lookup\"/> method.\n+    /// </summary>\n+    public class Dispatcher : MessageDispatcher","path":"src/core/Akka/Dispatch/Dispatcher.cs","position":15,"original_position":15,"commit_id":"79f5e03234dfcc394e6f3b4f163d08f00843bbd1","original_commit_id":"79f5e03234dfcc394e6f3b4f163d08f00843bbd1","user":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"body":"Generic `Dispatcher` - runs anything that isn't a `PinnedDispatcher`. The following dispatcher types have all been consolidated into `ExecutorService` implementations which run inside this class:\r\n\r\n* ThreadPoolDispatcher\r\n* ForkJoinDispatcher\r\n* TaskDispatcher\r\n* CurrentSynchronizationContextDispatcher","created_at":"2016-06-23T00:32:37Z","updated_at":"2016-06-23T00:32:37Z","html_url":"https://github.com/akkadotnet/akka.net/pull/2113#discussion_r68159516","pull_request_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113","_links":{"self":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/comments/68159516"},"html":{"href":"https://github.com/akkadotnet/akka.net/pull/2113#discussion_r68159516"},"pull_request":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113"}}},"pull_request":{"url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113","id":74879130,"html_url":"https://github.com/akkadotnet/akka.net/pull/2113","diff_url":"https://github.com/akkadotnet/akka.net/pull/2113.diff","patch_url":"https://github.com/akkadotnet/akka.net/pull/2113.patch","issue_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2113","number":2113,"state":"open","locked":false,"title":"extracted ExecutorService from Dispatcher; implemented ActorModelSpec","user":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"body":"close #2106 - extracted ExecutorService from Dispatcher; standardized dispatcher classes; made backwards compatible\r\nclose #2015 - implemented ActorModelSpec for ThreadPool dispatcher\r\n\r\n## Rationale\r\nIn the JVM the `Dispatcher` and the `ExecutorService` serve two distinct roles in the course of processing actor events:\r\n1. `Dispatcher` is responsible for guaranteeing 1 run at a time of any given mailbox; accounting for the number of active actors and tasks being executed on it in order to safely shutdown; and managing the relationship between `ActorCell` and `Mailbox`.\r\n2. `ExecutorService` is responsible for the execution of all events, namely mailbox processing.\r\n\r\nUntil this PR the `Dispatcher` has been filling both roles, which makes it difficult to test anything in isolation and increases the likelihood of the accounting code being wrong across each implementation. Additionally, a dispatcher is supposed to be able to restart its executor - imagine a group of actors all using the same `ForkJoinExecutor` on the same dispatcher are terminated, and then later a new actor wants to use that same dispatcher. The behavior today would cause that actor to fail. With these changes the dispatcher simply terminates the old `ExecutorService` when the last actor unregisters, and then lazily instantiates a new `ExecutorService` as soon as the dispatcher is ever needed again.\r\n\r\nThe `ActorModelSpec`, which I've also ported, verifies all of this. I also edited our built-in HOCON files to use the new `executor` property for dispatchers (this exists on the JVM.) I also made sure that the `Dispatchers` class will remain backwards compatible for any users who are using the old dispatcher type system we had in-place before and I was able to verify that works as intended by running the Akka.Remote and Akka.Cluster test suites with no edits to their configuration.","created_at":"2016-06-23T00:24:27Z","updated_at":"2016-06-23T00:32:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c77621454ba7fa6b2dde2927eb6721800ba48886","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113/commits","review_comments_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113/comments","review_comment_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2113/comments","statuses_url":"https://api.github.com/repos/akkadotnet/akka.net/statuses/79f5e03234dfcc394e6f3b4f163d08f00843bbd1","head":{"label":"Aaronontheweb:actormodelspec","ref":"actormodelspec","sha":"79f5e03234dfcc394e6f3b4f163d08f00843bbd1","user":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"repo":{"id":16661964,"name":"akka.net","full_name":"Aaronontheweb/akka.net","owner":{"login":"Aaronontheweb","id":326939,"avatar_url":"https://avatars.githubusercontent.com/u/326939?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaronontheweb","html_url":"https://github.com/Aaronontheweb","followers_url":"https://api.github.com/users/Aaronontheweb/followers","following_url":"https://api.github.com/users/Aaronontheweb/following{/other_user}","gists_url":"https://api.github.com/users/Aaronontheweb/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaronontheweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaronontheweb/subscriptions","organizations_url":"https://api.github.com/users/Aaronontheweb/orgs","repos_url":"https://api.github.com/users/Aaronontheweb/repos","events_url":"https://api.github.com/users/Aaronontheweb/events{/privacy}","received_events_url":"https://api.github.com/users/Aaronontheweb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Aaronontheweb/akka.net","description":"Port of Akka actors for .NET","fork":true,"url":"https://api.github.com/repos/Aaronontheweb/akka.net","forks_url":"https://api.github.com/repos/Aaronontheweb/akka.net/forks","keys_url":"https://api.github.com/repos/Aaronontheweb/akka.net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Aaronontheweb/akka.net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Aaronontheweb/akka.net/teams","hooks_url":"https://api.github.com/repos/Aaronontheweb/akka.net/hooks","issue_events_url":"https://api.github.com/repos/Aaronontheweb/akka.net/issues/events{/number}","events_url":"https://api.github.com/repos/Aaronontheweb/akka.net/events","assignees_url":"https://api.github.com/repos/Aaronontheweb/akka.net/assignees{/user}","branches_url":"https://api.github.com/repos/Aaronontheweb/akka.net/branches{/branch}","tags_url":"https://api.github.com/repos/Aaronontheweb/akka.net/tags","blobs_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/refs{/sha}","trees_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Aaronontheweb/akka.net/statuses/{sha}","languages_url":"https://api.github.com/repos/Aaronontheweb/akka.net/languages","stargazers_url":"https://api.github.com/repos/Aaronontheweb/akka.net/stargazers","contributors_url":"https://api.github.com/repos/Aaronontheweb/akka.net/contributors","subscribers_url":"https://api.github.com/repos/Aaronontheweb/akka.net/subscribers","subscription_url":"https://api.github.com/repos/Aaronontheweb/akka.net/subscription","commits_url":"https://api.github.com/repos/Aaronontheweb/akka.net/commits{/sha}","git_commits_url":"https://api.github.com/repos/Aaronontheweb/akka.net/git/commits{/sha}","comments_url":"https://api.github.com/repos/Aaronontheweb/akka.net/comments{/number}","issue_comment_url":"https://api.github.com/repos/Aaronontheweb/akka.net/issues/comments{/number}","contents_url":"https://api.github.com/repos/Aaronontheweb/akka.net/contents/{+path}","compare_url":"https://api.github.com/repos/Aaronontheweb/akka.net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Aaronontheweb/akka.net/merges","archive_url":"https://api.github.com/repos/Aaronontheweb/akka.net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Aaronontheweb/akka.net/downloads","issues_url":"https://api.github.com/repos/Aaronontheweb/akka.net/issues{/number}","pulls_url":"https://api.github.com/repos/Aaronontheweb/akka.net/pulls{/number}","milestones_url":"https://api.github.com/repos/Aaronontheweb/akka.net/milestones{/number}","notifications_url":"https://api.github.com/repos/Aaronontheweb/akka.net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Aaronontheweb/akka.net/labels{/name}","releases_url":"https://api.github.com/repos/Aaronontheweb/akka.net/releases{/id}","deployments_url":"https://api.github.com/repos/Aaronontheweb/akka.net/deployments","created_at":"2014-02-09T07:12:05Z","updated_at":"2016-03-07T21:09:57Z","pushed_at":"2016-06-23T00:17:26Z","git_url":"git://github.com/Aaronontheweb/akka.net.git","ssh_url":"git@github.com:Aaronontheweb/akka.net.git","clone_url":"https://github.com/Aaronontheweb/akka.net.git","svn_url":"https://github.com/Aaronontheweb/akka.net","homepage":"","size":54066,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akkadotnet:dev","ref":"dev","sha":"2f0c64c28d07d499d281e922923e3e7e7a8405b8","user":{"login":"akkadotnet","id":7003835,"avatar_url":"https://avatars.githubusercontent.com/u/7003835?v=3","gravatar_id":"","url":"https://api.github.com/users/akkadotnet","html_url":"https://github.com/akkadotnet","followers_url":"https://api.github.com/users/akkadotnet/followers","following_url":"https://api.github.com/users/akkadotnet/following{/other_user}","gists_url":"https://api.github.com/users/akkadotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/akkadotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akkadotnet/subscriptions","organizations_url":"https://api.github.com/users/akkadotnet/orgs","repos_url":"https://api.github.com/users/akkadotnet/repos","events_url":"https://api.github.com/users/akkadotnet/events{/privacy}","received_events_url":"https://api.github.com/users/akkadotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":15509440,"name":"akka.net","full_name":"akkadotnet/akka.net","owner":{"login":"akkadotnet","id":7003835,"avatar_url":"https://avatars.githubusercontent.com/u/7003835?v=3","gravatar_id":"","url":"https://api.github.com/users/akkadotnet","html_url":"https://github.com/akkadotnet","followers_url":"https://api.github.com/users/akkadotnet/followers","following_url":"https://api.github.com/users/akkadotnet/following{/other_user}","gists_url":"https://api.github.com/users/akkadotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/akkadotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akkadotnet/subscriptions","organizations_url":"https://api.github.com/users/akkadotnet/orgs","repos_url":"https://api.github.com/users/akkadotnet/repos","events_url":"https://api.github.com/users/akkadotnet/events{/privacy}","received_events_url":"https://api.github.com/users/akkadotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akkadotnet/akka.net","description":"Port of Akka actors for .NET","fork":false,"url":"https://api.github.com/repos/akkadotnet/akka.net","forks_url":"https://api.github.com/repos/akkadotnet/akka.net/forks","keys_url":"https://api.github.com/repos/akkadotnet/akka.net/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akkadotnet/akka.net/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akkadotnet/akka.net/teams","hooks_url":"https://api.github.com/repos/akkadotnet/akka.net/hooks","issue_events_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/events{/number}","events_url":"https://api.github.com/repos/akkadotnet/akka.net/events","assignees_url":"https://api.github.com/repos/akkadotnet/akka.net/assignees{/user}","branches_url":"https://api.github.com/repos/akkadotnet/akka.net/branches{/branch}","tags_url":"https://api.github.com/repos/akkadotnet/akka.net/tags","blobs_url":"https://api.github.com/repos/akkadotnet/akka.net/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akkadotnet/akka.net/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akkadotnet/akka.net/git/refs{/sha}","trees_url":"https://api.github.com/repos/akkadotnet/akka.net/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akkadotnet/akka.net/statuses/{sha}","languages_url":"https://api.github.com/repos/akkadotnet/akka.net/languages","stargazers_url":"https://api.github.com/repos/akkadotnet/akka.net/stargazers","contributors_url":"https://api.github.com/repos/akkadotnet/akka.net/contributors","subscribers_url":"https://api.github.com/repos/akkadotnet/akka.net/subscribers","subscription_url":"https://api.github.com/repos/akkadotnet/akka.net/subscription","commits_url":"https://api.github.com/repos/akkadotnet/akka.net/commits{/sha}","git_commits_url":"https://api.github.com/repos/akkadotnet/akka.net/git/commits{/sha}","comments_url":"https://api.github.com/repos/akkadotnet/akka.net/comments{/number}","issue_comment_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/comments{/number}","contents_url":"https://api.github.com/repos/akkadotnet/akka.net/contents/{+path}","compare_url":"https://api.github.com/repos/akkadotnet/akka.net/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akkadotnet/akka.net/merges","archive_url":"https://api.github.com/repos/akkadotnet/akka.net/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akkadotnet/akka.net/downloads","issues_url":"https://api.github.com/repos/akkadotnet/akka.net/issues{/number}","pulls_url":"https://api.github.com/repos/akkadotnet/akka.net/pulls{/number}","milestones_url":"https://api.github.com/repos/akkadotnet/akka.net/milestones{/number}","notifications_url":"https://api.github.com/repos/akkadotnet/akka.net/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akkadotnet/akka.net/labels{/name}","releases_url":"https://api.github.com/repos/akkadotnet/akka.net/releases{/id}","deployments_url":"https://api.github.com/repos/akkadotnet/akka.net/deployments","created_at":"2013-12-29T14:17:38Z","updated_at":"2016-06-22T20:03:25Z","pushed_at":"2016-06-23T00:24:27Z","git_url":"git://github.com/akkadotnet/akka.net.git","ssh_url":"git@github.com:akkadotnet/akka.net.git","clone_url":"https://github.com/akkadotnet/akka.net.git","svn_url":"https://github.com/akkadotnet/akka.net","homepage":"http://getakka.net","size":58465,"stargazers_count":1757,"watchers_count":1757,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":482,"mirror_url":null,"open_issues_count":195,"forks":482,"open_issues":195,"watchers":1757,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113"},"html":{"href":"https://github.com/akkadotnet/akka.net/pull/2113"},"issue":{"href":"https://api.github.com/repos/akkadotnet/akka.net/issues/2113"},"comments":{"href":"https://api.github.com/repos/akkadotnet/akka.net/issues/2113/comments"},"review_comments":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113/comments"},"review_comment":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akkadotnet/akka.net/pulls/2113/commits"},"statuses":{"href":"https://api.github.com/repos/akkadotnet/akka.net/statuses/79f5e03234dfcc394e6f3b4f163d08f00843bbd1"}}}}
{"actor":{"display_login":"Aaronontheweb"}}