{"action":"created","comment":{"url":"https://api.github.com/repos/eXist-db/exist/pulls/comments/73682874","id":73682874,"diff_hunk":"@@ -0,0 +1,319 @@\n+/*\n+ * eXist Open Source Native XML Database\n+ * Copyright (C) 2003-2016 The eXist-db Project\n+ * http://exist-db.org\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public License\n+ * as published by the Free Software Foundation; either version 2\n+ * of the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation\n+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n+ */\n+package org.exist.storage;\n+\n+import net.jcip.annotations.GuardedBy;\n+import org.apache.logging.log4j.LogManager;\n+import org.apache.logging.log4j.Logger;\n+import org.exist.EXistException;\n+import org.exist.util.Configuration;\n+import org.exist.util.DatabaseConfigurationException;\n+import org.exist.util.function.ConsumerE;\n+\n+import java.util.*;\n+import java.util.concurrent.locks.Lock;\n+import java.util.concurrent.locks.ReadWriteLock;\n+import java.util.concurrent.locks.ReentrantReadWriteLock;\n+\n+/**\n+ * This abstract class really just contains the static\n+ * methods for {@link BrokerPool} to help us organise the\n+ * code into smaller understandable chunks and reduce the\n+ * complexity when understanding the concurrency\n+ * constraints between one and many BrokerPools\n+ *\n+ * @author Adam Retter <adam@exist-db.org>\n+ * @author Wolfgang Meier <wolfgang@exist-db.org>\n+ * @author Pierrick Brihaye <pierrick.brihaye@free.fr>\n+ */\n+abstract class BrokerPools {\n+\n+    private static final Logger LOG = LogManager.getLogger(BrokerPools.class);\n+\n+    private static final ReadWriteLock instancesLock = new ReentrantReadWriteLock();\n+    @GuardedBy(\"instancesLock\") private static final Map<String, BrokerPool> instances = new TreeMap<>();\n+\n+    /**\n+     * The name of a default database instance\n+     */\n+    public static String DEFAULT_INSTANCE_NAME = \"exist\";\n+\n+    // register a shutdown hook\n+    static {\n+        try {\n+            Runtime.getRuntime().addShutdownHook(new Thread(\"BrokerPools-ShutdownHook\") {","path":"src/org/exist/storage/BrokerPools.java","position":61,"original_position":61,"commit_id":"61d80ad8fbaa6fedd2445169a447932121996c41","original_commit_id":"8844779473fb06a8f05b9e75eaaea92460de2119","user":{"login":"shabanovd","id":112634,"avatar_url":"https://avatars.githubusercontent.com/u/112634?v=3","gravatar_id":"","url":"https://api.github.com/users/shabanovd","html_url":"https://github.com/shabanovd","followers_url":"https://api.github.com/users/shabanovd/followers","following_url":"https://api.github.com/users/shabanovd/following{/other_user}","gists_url":"https://api.github.com/users/shabanovd/gists{/gist_id}","starred_url":"https://api.github.com/users/shabanovd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shabanovd/subscriptions","organizations_url":"https://api.github.com/users/shabanovd/orgs","repos_url":"https://api.github.com/users/shabanovd/repos","events_url":"https://api.github.com/users/shabanovd/events{/privacy}","received_events_url":"https://api.github.com/users/shabanovd/received_events","type":"User","site_admin":false},"body":"@adamretter if so, why you didn't cleanup `exist.register-shutdown-hook` staff?","created_at":"2016-08-05T12:15:43Z","updated_at":"2016-08-05T12:15:43Z","html_url":"https://github.com/eXist-db/exist/pull/1082#discussion_r73682874","pull_request_url":"https://api.github.com/repos/eXist-db/exist/pulls/1082","_links":{"self":{"href":"https://api.github.com/repos/eXist-db/exist/pulls/comments/73682874"},"html":{"href":"https://github.com/eXist-db/exist/pull/1082#discussion_r73682874"},"pull_request":{"href":"https://api.github.com/repos/eXist-db/exist/pulls/1082"}}},"pull_request":{"url":"https://api.github.com/repos/eXist-db/exist/pulls/1082","id":80221076,"html_url":"https://github.com/eXist-db/exist/pull/1082","diff_url":"https://github.com/eXist-db/exist/pull/1082.diff","patch_url":"https://github.com/eXist-db/exist/pull/1082.patch","issue_url":"https://api.github.com/repos/eXist-db/exist/issues/1082","number":1082,"state":"open","locked":false,"title":"Refactor BrokerPool","user":{"login":"adamretter","id":1264057,"avatar_url":"https://avatars.githubusercontent.com/u/1264057?v=3","gravatar_id":"","url":"https://api.github.com/users/adamretter","html_url":"https://github.com/adamretter","followers_url":"https://api.github.com/users/adamretter/followers","following_url":"https://api.github.com/users/adamretter/following{/other_user}","gists_url":"https://api.github.com/users/adamretter/gists{/gist_id}","starred_url":"https://api.github.com/users/adamretter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamretter/subscriptions","organizations_url":"https://api.github.com/users/adamretter/orgs","repos_url":"https://api.github.com/users/adamretter/repos","events_url":"https://api.github.com/users/adamretter/events{/privacy}","received_events_url":"https://api.github.com/users/adamretter/received_events","type":"User","site_admin":false},"body":"Splits out the notion of several BrokerPool instances (the static part) from an instance of BrokerPool managing a pool of DBBrokers (the class instance part).\r\n\r\nAlso incorporates the changes from https://github.com/eXist-db/exist/pull/1081.\r\nCloses https://github.com/eXist-db/exist/issues/1075","created_at":"2016-08-05T10:20:14Z","updated_at":"2016-08-05T12:15:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29778107c95692b13bf506dad1db703be2be2c13","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/eXist-db/exist/milestones/3","html_url":"https://github.com/eXist-db/exist/milestones/eXist-3.0","labels_url":"https://api.github.com/repos/eXist-db/exist/milestones/3/labels","id":710929,"number":3,"title":"eXist-3.0","description":"Long term development, with significant changes","creator":{"login":"dizzzz","id":1700062,"avatar_url":"https://avatars.githubusercontent.com/u/1700062?v=3","gravatar_id":"","url":"https://api.github.com/users/dizzzz","html_url":"https://github.com/dizzzz","followers_url":"https://api.github.com/users/dizzzz/followers","following_url":"https://api.github.com/users/dizzzz/following{/other_user}","gists_url":"https://api.github.com/users/dizzzz/gists{/gist_id}","starred_url":"https://api.github.com/users/dizzzz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dizzzz/subscriptions","organizations_url":"https://api.github.com/users/dizzzz/orgs","repos_url":"https://api.github.com/users/dizzzz/repos","events_url":"https://api.github.com/users/dizzzz/events{/privacy}","received_events_url":"https://api.github.com/users/dizzzz/received_events","type":"User","site_admin":false},"open_issues":47,"closed_issues":185,"state":"open","created_at":"2014-07-05T12:32:58Z","updated_at":"2016-08-05T10:39:56Z","due_on":"2016-07-30T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/eXist-db/exist/pulls/1082/commits","review_comments_url":"https://api.github.com/repos/eXist-db/exist/pulls/1082/comments","review_comment_url":"https://api.github.com/repos/eXist-db/exist/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eXist-db/exist/issues/1082/comments","statuses_url":"https://api.github.com/repos/eXist-db/exist/statuses/61d80ad8fbaa6fedd2445169a447932121996c41","head":{"label":"adamretter:broker-pool-rewrite","ref":"broker-pool-rewrite","sha":"61d80ad8fbaa6fedd2445169a447932121996c41","user":{"login":"adamretter","id":1264057,"avatar_url":"https://avatars.githubusercontent.com/u/1264057?v=3","gravatar_id":"","url":"https://api.github.com/users/adamretter","html_url":"https://github.com/adamretter","followers_url":"https://api.github.com/users/adamretter/followers","following_url":"https://api.github.com/users/adamretter/following{/other_user}","gists_url":"https://api.github.com/users/adamretter/gists{/gist_id}","starred_url":"https://api.github.com/users/adamretter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamretter/subscriptions","organizations_url":"https://api.github.com/users/adamretter/orgs","repos_url":"https://api.github.com/users/adamretter/repos","events_url":"https://api.github.com/users/adamretter/events{/privacy}","received_events_url":"https://api.github.com/users/adamretter/received_events","type":"User","site_admin":false},"repo":{"id":11710746,"name":"exist","full_name":"adamretter/exist","owner":{"login":"adamretter","id":1264057,"avatar_url":"https://avatars.githubusercontent.com/u/1264057?v=3","gravatar_id":"","url":"https://api.github.com/users/adamretter","html_url":"https://github.com/adamretter","followers_url":"https://api.github.com/users/adamretter/followers","following_url":"https://api.github.com/users/adamretter/following{/other_user}","gists_url":"https://api.github.com/users/adamretter/gists{/gist_id}","starred_url":"https://api.github.com/users/adamretter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamretter/subscriptions","organizations_url":"https://api.github.com/users/adamretter/orgs","repos_url":"https://api.github.com/users/adamretter/repos","events_url":"https://api.github.com/users/adamretter/events{/privacy}","received_events_url":"https://api.github.com/users/adamretter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamretter/exist","description":"eXist Native XML Database","fork":true,"url":"https://api.github.com/repos/adamretter/exist","forks_url":"https://api.github.com/repos/adamretter/exist/forks","keys_url":"https://api.github.com/repos/adamretter/exist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamretter/exist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamretter/exist/teams","hooks_url":"https://api.github.com/repos/adamretter/exist/hooks","issue_events_url":"https://api.github.com/repos/adamretter/exist/issues/events{/number}","events_url":"https://api.github.com/repos/adamretter/exist/events","assignees_url":"https://api.github.com/repos/adamretter/exist/assignees{/user}","branches_url":"https://api.github.com/repos/adamretter/exist/branches{/branch}","tags_url":"https://api.github.com/repos/adamretter/exist/tags","blobs_url":"https://api.github.com/repos/adamretter/exist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamretter/exist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamretter/exist/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamretter/exist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamretter/exist/statuses/{sha}","languages_url":"https://api.github.com/repos/adamretter/exist/languages","stargazers_url":"https://api.github.com/repos/adamretter/exist/stargazers","contributors_url":"https://api.github.com/repos/adamretter/exist/contributors","subscribers_url":"https://api.github.com/repos/adamretter/exist/subscribers","subscription_url":"https://api.github.com/repos/adamretter/exist/subscription","commits_url":"https://api.github.com/repos/adamretter/exist/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamretter/exist/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamretter/exist/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamretter/exist/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamretter/exist/contents/{+path}","compare_url":"https://api.github.com/repos/adamretter/exist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamretter/exist/merges","archive_url":"https://api.github.com/repos/adamretter/exist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamretter/exist/downloads","issues_url":"https://api.github.com/repos/adamretter/exist/issues{/number}","pulls_url":"https://api.github.com/repos/adamretter/exist/pulls{/number}","milestones_url":"https://api.github.com/repos/adamretter/exist/milestones{/number}","notifications_url":"https://api.github.com/repos/adamretter/exist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamretter/exist/labels{/name}","releases_url":"https://api.github.com/repos/adamretter/exist/releases{/id}","deployments_url":"https://api.github.com/repos/adamretter/exist/deployments","created_at":"2013-07-27T20:42:43Z","updated_at":"2015-11-27T12:54:28Z","pushed_at":"2016-08-05T00:46:11Z","git_url":"git://github.com/adamretter/exist.git","ssh_url":"git@github.com:adamretter/exist.git","clone_url":"https://github.com/adamretter/exist.git","svn_url":"https://github.com/adamretter/exist","homepage":null,"size":455931,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"develop"}},"base":{"label":"eXist-db:develop","ref":"develop","sha":"c84e19b1658e351d692b88cf8f300638a80543b5","user":{"login":"eXist-db","id":2393489,"avatar_url":"https://avatars.githubusercontent.com/u/2393489?v=3","gravatar_id":"","url":"https://api.github.com/users/eXist-db","html_url":"https://github.com/eXist-db","followers_url":"https://api.github.com/users/eXist-db/followers","following_url":"https://api.github.com/users/eXist-db/following{/other_user}","gists_url":"https://api.github.com/users/eXist-db/gists{/gist_id}","starred_url":"https://api.github.com/users/eXist-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eXist-db/subscriptions","organizations_url":"https://api.github.com/users/eXist-db/orgs","repos_url":"https://api.github.com/users/eXist-db/repos","events_url":"https://api.github.com/users/eXist-db/events{/privacy}","received_events_url":"https://api.github.com/users/eXist-db/received_events","type":"Organization","site_admin":false},"repo":{"id":11695619,"name":"exist","full_name":"eXist-db/exist","owner":{"login":"eXist-db","id":2393489,"avatar_url":"https://avatars.githubusercontent.com/u/2393489?v=3","gravatar_id":"","url":"https://api.github.com/users/eXist-db","html_url":"https://github.com/eXist-db","followers_url":"https://api.github.com/users/eXist-db/followers","following_url":"https://api.github.com/users/eXist-db/following{/other_user}","gists_url":"https://api.github.com/users/eXist-db/gists{/gist_id}","starred_url":"https://api.github.com/users/eXist-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eXist-db/subscriptions","organizations_url":"https://api.github.com/users/eXist-db/orgs","repos_url":"https://api.github.com/users/eXist-db/repos","events_url":"https://api.github.com/users/eXist-db/events{/privacy}","received_events_url":"https://api.github.com/users/eXist-db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eXist-db/exist","description":"eXist Native XML Database and Application Platform","fork":false,"url":"https://api.github.com/repos/eXist-db/exist","forks_url":"https://api.github.com/repos/eXist-db/exist/forks","keys_url":"https://api.github.com/repos/eXist-db/exist/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eXist-db/exist/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eXist-db/exist/teams","hooks_url":"https://api.github.com/repos/eXist-db/exist/hooks","issue_events_url":"https://api.github.com/repos/eXist-db/exist/issues/events{/number}","events_url":"https://api.github.com/repos/eXist-db/exist/events","assignees_url":"https://api.github.com/repos/eXist-db/exist/assignees{/user}","branches_url":"https://api.github.com/repos/eXist-db/exist/branches{/branch}","tags_url":"https://api.github.com/repos/eXist-db/exist/tags","blobs_url":"https://api.github.com/repos/eXist-db/exist/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eXist-db/exist/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eXist-db/exist/git/refs{/sha}","trees_url":"https://api.github.com/repos/eXist-db/exist/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eXist-db/exist/statuses/{sha}","languages_url":"https://api.github.com/repos/eXist-db/exist/languages","stargazers_url":"https://api.github.com/repos/eXist-db/exist/stargazers","contributors_url":"https://api.github.com/repos/eXist-db/exist/contributors","subscribers_url":"https://api.github.com/repos/eXist-db/exist/subscribers","subscription_url":"https://api.github.com/repos/eXist-db/exist/subscription","commits_url":"https://api.github.com/repos/eXist-db/exist/commits{/sha}","git_commits_url":"https://api.github.com/repos/eXist-db/exist/git/commits{/sha}","comments_url":"https://api.github.com/repos/eXist-db/exist/comments{/number}","issue_comment_url":"https://api.github.com/repos/eXist-db/exist/issues/comments{/number}","contents_url":"https://api.github.com/repos/eXist-db/exist/contents/{+path}","compare_url":"https://api.github.com/repos/eXist-db/exist/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eXist-db/exist/merges","archive_url":"https://api.github.com/repos/eXist-db/exist/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eXist-db/exist/downloads","issues_url":"https://api.github.com/repos/eXist-db/exist/issues{/number}","pulls_url":"https://api.github.com/repos/eXist-db/exist/pulls{/number}","milestones_url":"https://api.github.com/repos/eXist-db/exist/milestones{/number}","notifications_url":"https://api.github.com/repos/eXist-db/exist/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eXist-db/exist/labels{/name}","releases_url":"https://api.github.com/repos/eXist-db/exist/releases{/id}","deployments_url":"https://api.github.com/repos/eXist-db/exist/deployments","created_at":"2013-07-26T21:53:48Z","updated_at":"2016-08-04T22:01:18Z","pushed_at":"2016-08-05T10:20:14Z","git_url":"git://github.com/eXist-db/exist.git","ssh_url":"git@github.com:eXist-db/exist.git","clone_url":"https://github.com/eXist-db/exist.git","svn_url":"https://github.com/eXist-db/exist","homepage":"http://www.exist-db.org","size":565120,"stargazers_count":143,"watchers_count":143,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":221,"forks":85,"open_issues":221,"watchers":143,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/eXist-db/exist/pulls/1082"},"html":{"href":"https://github.com/eXist-db/exist/pull/1082"},"issue":{"href":"https://api.github.com/repos/eXist-db/exist/issues/1082"},"comments":{"href":"https://api.github.com/repos/eXist-db/exist/issues/1082/comments"},"review_comments":{"href":"https://api.github.com/repos/eXist-db/exist/pulls/1082/comments"},"review_comment":{"href":"https://api.github.com/repos/eXist-db/exist/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eXist-db/exist/pulls/1082/commits"},"statuses":{"href":"https://api.github.com/repos/eXist-db/exist/statuses/61d80ad8fbaa6fedd2445169a447932121996c41"}}}}
{"actor":{"display_login":"shabanovd"}}