{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/jetty.project/pulls/comments/219108984","pull_request_review_id":157177881,"id":219108984,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTEwODk4NA==","diff_hunk":"@@ -48,47 +49,38 @@\n     private final static Logger LOG = Log.getLogger(MBeanContainer.class.getName());\n     private final static ConcurrentMap<String, AtomicInteger> __unique = new ConcurrentHashMap<>();\n     private static final Container ROOT = new ContainerLifeCycle();\n+    private static final Class<?>[] OBJ_ARG = new Class[]{Object.class};\n \n     private final MBeanServer _mbeanServer;\n+    private final boolean _cacheOtherClassLoaders;\n+    private final ConcurrentMap<Class,Constructor<?>> _mbeanFor = new ConcurrentHashMap<>();\n+    private final ConcurrentMap<Class,MetaData> _metaData = new ConcurrentHashMap<>();\n     private final ConcurrentMap<Object, Container> _beans = new ConcurrentHashMap<>();\n     private final ConcurrentMap<Object, ObjectName> _mbeans = new ConcurrentHashMap<>();\n     private String _domain = null;\n \n-    /**\n-     * Lookup an object name by instance\n-     *\n-     * @param object instance for which object name is looked up\n-     * @return object name associated with specified instance, or null if not found\n-     */\n-    public ObjectName findMBean(Object object)\n-    {\n-        return _mbeans.get(object);\n-    }\n \n     /**\n-     * Lookup an instance by object name\n+     * Constructs MBeanContainer\n      *\n-     * @param objectName object name of instance\n-     * @return instance associated with specified object name, or null if not found\n+     * @param server instance of MBeanServer for use by container\n      */\n-    public Object findBean(ObjectName objectName)\n+    public MBeanContainer(MBeanServer server)\n     {\n-        for (Map.Entry<Object, ObjectName> entry : _mbeans.entrySet())\n-        {\n-            if (entry.getValue().equals(objectName))\n-                return entry.getKey();\n-        }\n-        return null;\n+        this(server,true);\n     }\n \n     /**\n      * Constructs MBeanContainer\n      *\n      * @param server instance of MBeanServer for use by container\n+     * @param cacheOtherClassLoaders If true,  MBeans from other classloaders (eg WebAppClassLoader) will be cached.\n+     *                               The cache is never flushed, so this should be false if some classloaders do not live forever.\n      */\n-    public MBeanContainer(MBeanServer server)\n+    public MBeanContainer(MBeanServer server, boolean cacheOtherClassLoaders)\n     {\n         _mbeanServer = server;\n+        _cacheOtherClassLoaders = cacheOtherClassLoaders;","path":"jetty-jmx/src/main/java/org/eclipse/jetty/jmx/MBeanContainer.java","position":84,"original_position":84,"commit_id":"ac84e35b7ebd86bada253331c7cb47d4e1e39fd1","original_commit_id":"ac84e35b7ebd86bada253331c7cb47d4e1e39fd1","user":{"login":"sbordet","id":414681,"node_id":"MDQ6VXNlcjQxNDY4MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/414681?v=4","gravatar_id":"","url":"https://api.github.com/users/sbordet","html_url":"https://github.com/sbordet","followers_url":"https://api.github.com/users/sbordet/followers","following_url":"https://api.github.com/users/sbordet/following{/other_user}","gists_url":"https://api.github.com/users/sbordet/gists{/gist_id}","starred_url":"https://api.github.com/users/sbordet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbordet/subscriptions","organizations_url":"https://api.github.com/users/sbordet/orgs","repos_url":"https://api.github.com/users/sbordet/repos","events_url":"https://api.github.com/users/sbordet/events{/privacy}","received_events_url":"https://api.github.com/users/sbordet/received_events","type":"User","site_admin":false},"body":"See below on why do we need this boolean.","created_at":"2018-09-20T10:18:30Z","updated_at":"2018-09-20T10:59:21Z","html_url":"https://github.com/eclipse/jetty.project/pull/2924#discussion_r219108984","pull_request_url":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/eclipse/jetty.project/pulls/comments/219108984"},"html":{"href":"https://github.com/eclipse/jetty.project/pull/2924#discussion_r219108984"},"pull_request":{"href":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924"}}},"pull_request":{"url":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924","id":216823150,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2ODIzMTUw","html_url":"https://github.com/eclipse/jetty.project/pull/2924","diff_url":"https://github.com/eclipse/jetty.project/pull/2924.diff","patch_url":"https://github.com/eclipse/jetty.project/pull/2924.patch","issue_url":"https://api.github.com/repos/eclipse/jetty.project/issues/2924","number":2924,"state":"open","locked":false,"title":"Jetty 9.4.x 2727 mbean info caching","user":{"login":"gregw","id":70829,"node_id":"MDQ6VXNlcjcwODI5","avatar_url":"https://avatars2.githubusercontent.com/u/70829?v=4","gravatar_id":"","url":"https://api.github.com/users/gregw","html_url":"https://github.com/gregw","followers_url":"https://api.github.com/users/gregw/followers","following_url":"https://api.github.com/users/gregw/following{/other_user}","gists_url":"https://api.github.com/users/gregw/gists{/gist_id}","starred_url":"https://api.github.com/users/gregw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregw/subscriptions","organizations_url":"https://api.github.com/users/gregw/orgs","repos_url":"https://api.github.com/users/gregw/repos","events_url":"https://api.github.com/users/gregw/events{/privacy}","received_events_url":"https://api.github.com/users/gregw/received_events","type":"User","site_admin":false},"body":"This PR addresses #2727 by caching:\r\n * A map of class to MBean constructor to select which MBean instance to create.\r\n * A map of mbean class to meta data about previously found annotations etc.\r\nThe cache is never cleared unless the MBeanContainer is destroyed, so be default only classes for the same classloader are added to the cache (but this can be overloaded).\r\n","created_at":"2018-09-20T01:54:07Z","updated_at":"2018-09-20T10:59:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e668d5e1151c233c7c20983f03c46c108de60877","assignee":null,"assignees":[],"requested_reviewers":[{"login":"joakime","id":191721,"node_id":"MDQ6VXNlcjE5MTcyMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/191721?v=4","gravatar_id":"","url":"https://api.github.com/users/joakime","html_url":"https://github.com/joakime","followers_url":"https://api.github.com/users/joakime/followers","following_url":"https://api.github.com/users/joakime/following{/other_user}","gists_url":"https://api.github.com/users/joakime/gists{/gist_id}","starred_url":"https://api.github.com/users/joakime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakime/subscriptions","organizations_url":"https://api.github.com/users/joakime/orgs","repos_url":"https://api.github.com/users/joakime/repos","events_url":"https://api.github.com/users/joakime/events{/privacy}","received_events_url":"https://api.github.com/users/joakime/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924/commits","review_comments_url":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924/comments","review_comment_url":"https://api.github.com/repos/eclipse/jetty.project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/jetty.project/issues/2924/comments","statuses_url":"https://api.github.com/repos/eclipse/jetty.project/statuses/ac84e35b7ebd86bada253331c7cb47d4e1e39fd1","head":{"label":"eclipse:jetty-9.4.x-2727-mbeanInfoCaching","ref":"jetty-9.4.x-2727-mbeanInfoCaching","sha":"ac84e35b7ebd86bada253331c7cb47d4e1e39fd1","user":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":2045207,"node_id":"MDEwOlJlcG9zaXRvcnkyMDQ1MjA3","name":"jetty.project","full_name":"eclipse/jetty.project","private":false,"owner":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/eclipse/jetty.project","description":"Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more","fork":false,"url":"https://api.github.com/repos/eclipse/jetty.project","forks_url":"https://api.github.com/repos/eclipse/jetty.project/forks","keys_url":"https://api.github.com/repos/eclipse/jetty.project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/jetty.project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/jetty.project/teams","hooks_url":"https://api.github.com/repos/eclipse/jetty.project/hooks","issue_events_url":"https://api.github.com/repos/eclipse/jetty.project/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/jetty.project/events","assignees_url":"https://api.github.com/repos/eclipse/jetty.project/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/jetty.project/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/jetty.project/tags","blobs_url":"https://api.github.com/repos/eclipse/jetty.project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/jetty.project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/jetty.project/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/jetty.project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/jetty.project/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/jetty.project/languages","stargazers_url":"https://api.github.com/repos/eclipse/jetty.project/stargazers","contributors_url":"https://api.github.com/repos/eclipse/jetty.project/contributors","subscribers_url":"https://api.github.com/repos/eclipse/jetty.project/subscribers","subscription_url":"https://api.github.com/repos/eclipse/jetty.project/subscription","commits_url":"https://api.github.com/repos/eclipse/jetty.project/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/jetty.project/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/jetty.project/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/jetty.project/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/jetty.project/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/jetty.project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/jetty.project/merges","archive_url":"https://api.github.com/repos/eclipse/jetty.project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/jetty.project/downloads","issues_url":"https://api.github.com/repos/eclipse/jetty.project/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/jetty.project/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/jetty.project/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/jetty.project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/jetty.project/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/jetty.project/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/jetty.project/deployments","created_at":"2011-07-14T01:11:57Z","updated_at":"2018-09-20T09:07:07Z","pushed_at":"2018-09-20T09:07:04Z","git_url":"git://github.com/eclipse/jetty.project.git","ssh_url":"git@github.com:eclipse/jetty.project.git","clone_url":"https://github.com/eclipse/jetty.project.git","svn_url":"https://github.com/eclipse/jetty.project","homepage":"https://www.eclipse.org/jetty","size":118805,"stargazers_count":2190,"watchers_count":2190,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1241,"mirror_url":null,"archived":false,"open_issues_count":359,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1241,"open_issues":359,"watchers":2190,"default_branch":"jetty-9.4.x"}},"base":{"label":"eclipse:jetty-9.4.x","ref":"jetty-9.4.x","sha":"9fae0c2fa0327777cbb79d30c05179db83faf47e","user":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":2045207,"node_id":"MDEwOlJlcG9zaXRvcnkyMDQ1MjA3","name":"jetty.project","full_name":"eclipse/jetty.project","private":false,"owner":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/eclipse/jetty.project","description":"Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more","fork":false,"url":"https://api.github.com/repos/eclipse/jetty.project","forks_url":"https://api.github.com/repos/eclipse/jetty.project/forks","keys_url":"https://api.github.com/repos/eclipse/jetty.project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/jetty.project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/jetty.project/teams","hooks_url":"https://api.github.com/repos/eclipse/jetty.project/hooks","issue_events_url":"https://api.github.com/repos/eclipse/jetty.project/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/jetty.project/events","assignees_url":"https://api.github.com/repos/eclipse/jetty.project/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/jetty.project/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/jetty.project/tags","blobs_url":"https://api.github.com/repos/eclipse/jetty.project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/jetty.project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/jetty.project/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/jetty.project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/jetty.project/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/jetty.project/languages","stargazers_url":"https://api.github.com/repos/eclipse/jetty.project/stargazers","contributors_url":"https://api.github.com/repos/eclipse/jetty.project/contributors","subscribers_url":"https://api.github.com/repos/eclipse/jetty.project/subscribers","subscription_url":"https://api.github.com/repos/eclipse/jetty.project/subscription","commits_url":"https://api.github.com/repos/eclipse/jetty.project/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/jetty.project/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/jetty.project/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/jetty.project/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/jetty.project/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/jetty.project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/jetty.project/merges","archive_url":"https://api.github.com/repos/eclipse/jetty.project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/jetty.project/downloads","issues_url":"https://api.github.com/repos/eclipse/jetty.project/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/jetty.project/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/jetty.project/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/jetty.project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/jetty.project/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/jetty.project/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/jetty.project/deployments","created_at":"2011-07-14T01:11:57Z","updated_at":"2018-09-20T09:07:07Z","pushed_at":"2018-09-20T09:07:04Z","git_url":"git://github.com/eclipse/jetty.project.git","ssh_url":"git@github.com:eclipse/jetty.project.git","clone_url":"https://github.com/eclipse/jetty.project.git","svn_url":"https://github.com/eclipse/jetty.project","homepage":"https://www.eclipse.org/jetty","size":118805,"stargazers_count":2190,"watchers_count":2190,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1241,"mirror_url":null,"archived":false,"open_issues_count":359,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1241,"open_issues":359,"watchers":2190,"default_branch":"jetty-9.4.x"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924"},"html":{"href":"https://github.com/eclipse/jetty.project/pull/2924"},"issue":{"href":"https://api.github.com/repos/eclipse/jetty.project/issues/2924"},"comments":{"href":"https://api.github.com/repos/eclipse/jetty.project/issues/2924/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/jetty.project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/jetty.project/pulls/2924/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/jetty.project/statuses/ac84e35b7ebd86bada253331c7cb47d4e1e39fd1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sbordet"}}