From 3610dc445e01ee07faae64acaabcdc00aac5e1b5 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 2 Jul 2014 16:50:45 -0400 Subject: [PATCH] Delay pf4j instantiation and setup to start() --- .../com/gitblit/manager/PluginManager.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gitblit/manager/PluginManager.java b/src/main/java/com/gitblit/manager/PluginManager.java index dcf12b26..a35ff6fe 100644 --- a/src/main/java/com/gitblit/manager/PluginManager.java +++ b/src/main/java/com/gitblit/manager/PluginManager.java @@ -75,10 +75,10 @@ public class PluginManager implements IPluginManager, PluginStateListener { private final Logger logger = LoggerFactory.getLogger(getClass()); - private final DefaultPluginManager pf4j; - private final IRuntimeManager runtimeManager; + private DefaultPluginManager pf4j; + // timeout defaults of Maven 3.0.4 in seconds private int connectTimeout = 20; @@ -86,18 +86,7 @@ public class PluginManager implements IPluginManager, PluginStateListener { @Inject public PluginManager(IRuntimeManager runtimeManager) { - File dir = runtimeManager.getFileOrFolder(Keys.plugins.folder, "${baseFolder}/plugins"); - dir.mkdirs(); this.runtimeManager = runtimeManager; - - this.pf4j = new DefaultPluginManager(dir); - - try { - Version systemVersion = Version.createVersion(Constants.getVersion()); - pf4j.setSystemVersion(systemVersion); - } catch (Exception e) { - logger.error(null, e); - } } @Override @@ -112,6 +101,16 @@ public class PluginManager implements IPluginManager, PluginStateListener { @Override public PluginManager start() { + File dir = runtimeManager.getFileOrFolder(Keys.plugins.folder, "${baseFolder}/plugins"); + dir.mkdirs(); + pf4j = new DefaultPluginManager(dir); + + try { + Version systemVersion = Version.createVersion(Constants.getVersion()); + pf4j.setSystemVersion(systemVersion); + } catch (Exception e) { + logger.error(null, e); + } pf4j.loadPlugins(); logger.debug("Starting plugins"); pf4j.startPlugins(); -- 2.39.5