1 package com.atlassian.plugin.main;
2
3 import com.atlassian.plugin.PluginController;
4
5
6
7
8
9
10 public class HotDeployer {
11 private final PluginController pluginController;
12 private final Thread hotDeploy;
13 private boolean running;
14
15 public HotDeployer(PluginController pluginController, final long period) {
16 this.pluginController = pluginController;
17
18 hotDeploy = new Thread("Plugin Hot Deploy") {
19 @Override
20 public void run() {
21 running = true;
22 while (running) {
23
24 HotDeployer.this.pluginController.scanForNewPlugins();
25 try {
26 Thread.sleep(period);
27 } catch (InterruptedException e) {
28
29 break;
30 }
31 }
32 }
33 };
34 hotDeploy.setDaemon(true);
35 }
36
37 public void start() {
38 hotDeploy.start();
39 }
40
41 public void stop() {
42 running = false;
43 hotDeploy.interrupt();
44 }
45
46 public boolean isRunning() {
47 return running;
48 }
49 }