My objective is to be able to start and stop Jackrabbit instance regardless
of number of times.

I m able to successfully stop a Jackrabbit instance through the following
code.

        log.info("Unbind remote repository : {}.", getRemoteRepositoryName());
//$NON-NLS-1$
                UnicastRemoteObject.unexportObject(this.remoteRepository, true);
                getRmiRegistry().unbind(getRemoteRepositoryName());
                
                if 
(getSessionFactory().getRepository().getDescriptorKeys().length>0) {
            if (getSessionFactory().getRepository() instanceof
JackrabbitRepository) {
                log.info("HOOK JCR : shuttown JackRabbit Repository...");
               ((JackrabbitRepository)
getSessionFactory().getRepository()).shutdown();
            }
        }
                        

In the mean time starting Jackrabbit repository through the following code
generates IllegalStateException: 

        RepositoryConfig config = RepositoryConfig.create(repo.getConfig());
        RepositoryImpl.create(config);
        
Caused by: java.lang.IllegalStateException: this factory has already been
closed
        at
org.apache.jackrabbit.core.util.db.ConnectionFactory.sanityCheck(ConnectionFactory.java:215)
        at
org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:164)
        at
org.apache.jackrabbit.core.fs.db.DbFileSystem.getDataSource(DbFileSystem.java:226)
        at
org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:187)
        
A boolean value "closed" is set to true as soon as the repository is shut
down. When started later, it fails to reinitialize correctly.

 private void sanityCheck() {
        if (closed) {
            throw new IllegalStateException("this factory has already been
closed");
        }
    }



--
View this message in context: 
http://jackrabbit.510166.n4.nabble.com/sanityCheck-this-factory-has-already-been-closed-tp4657857.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Reply via email to