Line | |
---|
1 | package de.ugoe.cs.autoquest.htmlmonitor; |
---|
2 | |
---|
3 | /** |
---|
4 | * <p> |
---|
5 | * used to be able to shut down any {@link HtmlMonitorComponent} that must be stopped if the |
---|
6 | * application stops. |
---|
7 | * </p> |
---|
8 | * |
---|
9 | * @author Patrick Harms |
---|
10 | */ |
---|
11 | public class ShutdownHook implements Runnable { |
---|
12 | |
---|
13 | /** |
---|
14 | * the components to be stopped on shutdown |
---|
15 | */ |
---|
16 | private HtmlMonitorComponent[] components; |
---|
17 | |
---|
18 | /** |
---|
19 | * <p> |
---|
20 | * initializes the shutdown hook with the components to be shut down on shutdown of the whole |
---|
21 | * application |
---|
22 | * </p> |
---|
23 | * |
---|
24 | */ |
---|
25 | public ShutdownHook(HtmlMonitorComponent... components) { |
---|
26 | this.components = components; |
---|
27 | } |
---|
28 | |
---|
29 | /* (non-Javadoc) |
---|
30 | * @see java.lang.Thread#run() |
---|
31 | */ |
---|
32 | @Override |
---|
33 | public void run() { |
---|
34 | for (HtmlMonitorComponent component : components) { |
---|
35 | if (component != null) { |
---|
36 | component.stop(); |
---|
37 | } |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.