Make init synchronous again
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 24 Feb 2015 23:52:59 +0000 (23:52 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 24 Feb 2015 23:52:59 +0000 (23:52 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@7950 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/argeo_node_rap.properties
org.argeo.cms/src/org/argeo/cms/internal/kernel/Kernel.java
org.argeo.cms/src/org/argeo/cms/internal/kernel/KernelUtils.java

index 5aceaa68aafc111dd6f2c95dbb42ed9988a3c2b9..1593d11806799d776eccbe97dbccefdc60d8f27a 100644 (file)
@@ -1,10 +1,10 @@
-argeo.osgi.start.2.node=\
-org.argeo.cms
-
-argeo.osgi.start.3.http=\
+argeo.osgi.start.2.http=\
 org.eclipse.equinox.http.servlet,\
 org.eclipse.equinox.http.jetty
 
+argeo.osgi.start.3.node=\
+org.argeo.cms
+
 argeo.osgi.start.4.apps=\
 org.eclipse.rap.rwt.osgi,\
 org.eclipse.gemini.blueprint.extender
@@ -12,6 +12,8 @@ org.eclipse.gemini.blueprint.extender
 argeo.osgi.start.4.workbench=\
 org.eclipse.equinox.http.registry,\
 
+#argeo.node.repo.maxCacheMB=128
+
 org.osgi.service.http.port=7080
 org.eclipse.equinox.http.jetty.log.stderr.threshold=info
 
index f0c2d90d1f99758a1adc4e9238afa93e3324c3f3..ffba91a3e1a9346e4cd43154cdefba72b23738a5 100644 (file)
@@ -36,7 +36,8 @@ final class Kernel implements ServiceListener {
        private final static Log log = LogFactory.getLog(Kernel.class);
 
        private final BundleContext bundleContext;
-       private final ThreadGroup threadGroup = new ThreadGroup("Argeo CMS Kernel");
+       // private final ThreadGroup threadGroup = new
+       // ThreadGroup("Argeo CMS Kernel");
 
        private JackrabbitNode node;
        private RepositoryFactory repositoryFactory;
@@ -48,19 +49,22 @@ final class Kernel implements ServiceListener {
        }
 
        void init() {
-               new Thread(threadGroup, "init") {
-                       @Override
-                       public void run() {
-                               // CMS bundle classloader used during initialisation
-                               Thread.currentThread().setContextClassLoader(
-                                               Kernel.class.getClassLoader());
-                               doInit();
-                       }
-               }.start();
+               // new Thread(threadGroup, "init") {
+               // @Override
+               // public void run() {
+               // // CMS bundle classloader used during initialisation
+               // Thread.currentThread().setContextClassLoader(
+               // Kernel.class.getClassLoader());
+               doInit();
+               // }
+               // }.start();
        }
 
-       /** Run asynchronously */
        protected void doInit() {
+               ClassLoader currentContextCl = Thread.currentThread()
+                               .getContextClassLoader();
+               Thread.currentThread().setContextClassLoader(
+                               Kernel.class.getClassLoader());
                long begin = System.currentTimeMillis();
                InternalAuthentication initAuth = new InternalAuthentication(
                                KernelConstants.DEFAULT_SECURITY_KEY);
@@ -85,6 +89,8 @@ final class Kernel implements ServiceListener {
                } catch (Exception e) {
                        log.error("Cannot initialize Argeo CMS", e);
                        throw new ArgeoException("Cannot initialize", e);
+               } finally {
+                       Thread.currentThread().setContextClassLoader(currentContextCl);
                }
 
                long jvmUptime = ManagementFactory.getRuntimeMXBean().getUptime();
index eacb67c7db0fd3f9f590331ff8fe4b963bcfe3f5..0a9e6c53e44a2c24d7b438b526ce15ddda5f8214 100644 (file)
@@ -51,6 +51,17 @@ class KernelUtils implements KernelConstants {
                                .getAbsoluteFile();
        }
 
+       static String getFrameworkProp(String key, String def) {
+               String value = Activator.getBundleContext().getProperty(key);
+               if (value == null)
+                       return def;
+               return value;
+       }
+
+       static String getFrameworkProp(String key) {
+               return getFrameworkProp(key, null);
+       }
+
        // Security
        static void anonymousLogin(AuthenticationManager authenticationManager) {
                try {