Introduce Makefile for Java build
[lgpl/argeo-commons.git] / org.argeo.cms.jcr / src / org / argeo / cms / jcr / internal / RepositoryContextsFactory.java
index 2b9ad0043f1b5731c42d11b498a4859167971564..e05a0023e74acff795c7db5ff34e9d02e49e66bd 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);
                        }
@@ -69,7 +73,7 @@ public class RepositoryContextsFactory implements ManagedServiceFactory {
                                        RepositoryContext repositoryContext = repositories.remove(otherPid);
                                        repositories.put(pid, repositoryContext);
                                        if (log.isDebugEnabled())
-                                               log.debug("Ignore update of Jackrabbit repository " + cn);
+                                               log.debug("Ignoring update of Jackrabbit repository " + cn);
                                        // FIXME perform a proper update (also of the OSGi service)
                                        return;
                                }