Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-1778

BindableRepositoryFactory doesn't handle repository shutdown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 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, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.6, 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, 2.1
    • 2.1
    • jackrabbit-core
    • None

    Description

      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();

      Attachments

        Activity

          People

            jukkaz Jukka Zitting
            jukkaz Jukka Zitting
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: