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