Adapt after Argeo Suite refactoring.
[lgpl/argeo-commons.git] / org.argeo.cms.jcr / src / org / argeo / cms / jcr / internal / RepositoryContextsFactory.java
index 2b9ad0043f1b5731c42d11b498a4859167971564..2ffac9c4c9478dd2e24fd0d544605598147c5035 100644 (file)
@@ -38,10 +38,14 @@ public class RepositoryContextsFactory implements ManagedServiceFactory {
                for (String pid : repositories.keySet()) {
                        try {
                                RepositoryContext repositoryContext = repositories.get(pid);
-                               repositoryContext.getRepository().shutdown();
-                               if (log.isDebugEnabled())
-                                       log.debug("Shut down repository " + pid
-                                                       + (pidToCn.containsKey(pid) ? " (" + pidToCn.get(pid) + ")" : ""));
+                               // Must start in another thread otherwise shutdown is interrupted
+                               // TODO use an executor?
+                               new Thread(() -> {
+                                       repositoryContext.getRepository().shutdown();
+                                       if (log.isDebugEnabled())
+                                               log.debug("Shut down repository " + pid
+                                                               + (pidToCn.containsKey(pid) ? " (" + pidToCn.get(pid) + ")" : ""));
+                               }, "Shutdown JCR repository " + pid).start();
                        } catch (Exception e) {
                                log.error("Error when shutting down Jackrabbit repository " + pid, e);
                        }