Fix plugin reloading from PluginWatchThread

This commit is contained in:
Naoki Takezoe
2017-09-03 22:36:03 +09:00
parent 55a8602bba
commit eeabbfd599

View File

@@ -264,6 +264,7 @@ object PluginRegistry {
(extraJars ++ pluginJars).foreach { pluginJar => (extraJars ++ pluginJars).foreach { pluginJar =>
val installedJar = new File(installedDir, pluginJar.getName) val installedJar = new File(installedDir, pluginJar.getName)
FileUtils.copyFile(pluginJar, installedJar) FileUtils.copyFile(pluginJar, installedJar)
logger.info(s"Initialize ${pluginJar.getName}") logger.info(s"Initialize ${pluginJar.getName}")
@@ -400,13 +401,16 @@ class PluginWatchThread(context: ServletContext, dir: String) extends Thread wit
events.foreach { event => events.foreach { event =>
logger.info(event.kind + ": " + event.context) logger.info(event.kind + ": " + event.context)
} }
new Thread {
override def run(): Unit = {
gitbucket.core.servlet.Database() withTransaction { session => gitbucket.core.servlet.Database() withTransaction { session =>
logger.info("Reloading plugins...") logger.info("Reloading plugins...")
PluginRegistry.reload(context, loadSystemSettings(), session.conn) PluginRegistry.reload(context, loadSystemSettings(), session.conn)
logger.info("Reloading finished.") logger.info("Reloading finished.")
} }
} }
}.start()
}
detectedWatchKey.reset() detectedWatchKey.reset()
} }
} catch { } catch {