You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2008/09/30 15:21:44 UTC

[jira] Created: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

BindableRepositoryFactory doesn't handle repository shutdown
------------------------------------------------------------

                 Key: JCR-1778
                 URL: https://issues.apache.org/jira/browse/JCR-1778
             Project: Jackrabbit
          Issue Type: Bug
          Components: jackrabbit-core
            Reporter: Jukka Zitting
            Priority: Minor


The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.

This causes the following code snippet to fail with an IllegalStateException:

        Hashtable environment = new Hashtable();
        environment.put(
                Context.INITIAL_CONTEXT_FACTORY,
                DummyInitialContextFactory.class.getName());
        environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
        Context context = new InitialContext(environment);

        JackrabbitRepository repository;
        String xml = "src/test/repository/repository.xml";
        String dir = "target/repository";
        String key = "repository";

        // Create first repository
        RegistryHelper.registerRepository(context, key, xml, dir, true);
        repository = (JackrabbitRepository) context.lookup(key);
        repository.login().logout();
        repository.shutdown();

        // Create second repository with the same configuration
        RegistryHelper.registerRepository(context, key, xml, dir, true);
        repository = (JackrabbitRepository) context.lookup(key);
        repository.login().logout(); // throws an IllegalStateException!
        repository.shutdown();


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663276#action_12663276 ] 

Jukka Zitting commented on JCR-1778:
------------------------------------

> Seems to me as this is (if only by accident) related to JCR-1823

Yes, now the test case throws a RepositoryException instead of an IllegalStateException. This is still incorrect.

> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "René Link (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

René Link updated JCR-1778:
---------------------------

    Affects Version/s: 2.1.0
                       2.0.0
                       1.6.1
                       1.5.8
                       core 1.4.6
                       core 1.4.8
                       core 1.4.7
                       core 1.4.9
                       core 1.4.10
                       core-1.4.11
                       1.5.0
                       1.5.2
                       1.5.3
                       1.5.4
                       1.5.5
                       1.5.6
                       1.5.7
                       1.6.0
                       2.0-alpha1
                       2.0-alpha3
                       2.0-alpha4
                       2.0-alpha7
                       2.0-alpha8
                       2.0-alpha9
                       2.0-alpha11
                       2.0-beta1
                       2.0-beta3
                       2.0-beta4
                       2.0-beta5
                       2.0-beta6
               Status: Patch Available  (was: Open)

Patch  do prevent invalid repository object to remain in the BindableRepositoryFactory's cache

> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.0-beta6, 2.0-beta5, 2.0-beta4, 2.0-beta3, 2.0-beta1, 2.0-alpha11, 2.0-alpha9, 2.0-alpha8, 2.0-alpha7, 2.0-alpha4, 2.0-alpha3, 2.0-alpha1, 1.6.0, 1.5.7, 1.5.6, 1.5.5, 1.5.4, 1.5.3, 1.5.2, 1.5.0, core-1.4.11, core 1.4.10, core 1.4.9, core 1.4.7, core 1.4.8, core 1.4.6, 1.5.8, 1.6.1, 2.0.0, 2.1.0
>            Reporter: Jukka Zitting
>            Priority: Minor
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "Grégory Joseph (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663117#action_12663117 ] 

Grégory Joseph commented on JCR-1778:
-------------------------------------

Seems to as this is (if only by accident) related to JCR-1823

> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1778:
-------------------------------

           Status: Resolved  (was: Patch Available)
         Assignee: Jukka Zitting
    Fix Version/s: 2.1.0
       Resolution: Fixed

Thanks for the patch! I committed a slightly modified version to Jackrabbit trunk in revision 933694 and merged the change to the 2.1 branch in revision 933697.

> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: core 1.4.6, core 1.4.8, core 1.4.7, core 1.4.9, core 1.4.10, core-1.4.11, 1.5.0, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.6.0, 1.6.1, 2.0-alpha1, 2.0-alpha3, 2.0-alpha4, 2.0-alpha7, 2.0-alpha8, 2.0-alpha9, 2.0-alpha11, 2.0-beta1, 2.0-beta3, 2.0-beta4, 2.0-beta5, 2.0-beta6, 2.0.0, 2.1.0
>            Reporter: Jukka Zitting
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 2.1.0
>
>         Attachments: BindableRepositoryFactory.java.patch
>
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "Grégory Joseph (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663117#action_12663117 ] 

gjoseph edited comment on JCR-1778 at 1/12/09 2:08 PM:
--------------------------------------------------------------

Seems to me as this is (if only by accident) related to JCR-1823

      was (Author: gjoseph):
    Seems to as this is (if only by accident) related to JCR-1823
  
> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "René Link (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

René Link updated JCR-1778:
---------------------------

    Attachment: BindableRepositoryFactory.java.patch

> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: core 1.4.6, core 1.4.8, core 1.4.7, core 1.4.9, core 1.4.10, core-1.4.11, 1.5.0, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.6.0, 1.6.1, 2.0-alpha1, 2.0-alpha3, 2.0-alpha4, 2.0-alpha7, 2.0-alpha8, 2.0-alpha9, 2.0-alpha11, 2.0-beta1, 2.0-beta3, 2.0-beta4, 2.0-beta5, 2.0-beta6, 2.0.0, 2.1.0
>            Reporter: Jukka Zitting
>            Priority: Minor
>         Attachments: BindableRepositoryFactory.java.patch
>
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1778) BindableRepositoryFactory doesn't handle repository shutdown

Posted by "Grégory Joseph (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660836#action_12660836 ] 

Grégory Joseph commented on JCR-1778:
-------------------------------------

Same goes if you replace {{repository.shutdown()}} by a call to {{RegistryHelper.unregisterRepository}} which is even more worrying. The issue seems to be due to the static cache of BindableRepositoryFactory.
I can reproduce this with 1.4.6 and 1.5.0, not with 1.4.5

> BindableRepositoryFactory doesn't handle repository shutdown
> ------------------------------------------------------------
>
>                 Key: JCR-1778
>                 URL: https://issues.apache.org/jira/browse/JCR-1778
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>            Reporter: Jukka Zitting
>            Priority: Minor
>
> The BindableRepositoryFactory class keeps a cached reference to a repository even after the repository has been shut down.
> This causes the following code snippet to fail with an IllegalStateException:
>         Hashtable environment = new Hashtable();
>         environment.put(
>                 Context.INITIAL_CONTEXT_FACTORY,
>                 DummyInitialContextFactory.class.getName());
>         environment.put(Context.PROVIDER_URL, "http://jackrabbit.apache.org/");
>         Context context = new InitialContext(environment);
>         JackrabbitRepository repository;
>         String xml = "src/test/repository/repository.xml";
>         String dir = "target/repository";
>         String key = "repository";
>         // Create first repository
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout();
>         repository.shutdown();
>         // Create second repository with the same configuration
>         RegistryHelper.registerRepository(context, key, xml, dir, true);
>         repository = (JackrabbitRepository) context.lookup(key);
>         repository.login().logout(); // throws an IllegalStateException!
>         repository.shutdown();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.