|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| package org.abraracourcix.alipes.alerters; |
|
6 |
| import java.net.MalformedURLException; |
|
7 |
| import java.net.URL; |
|
8 |
| import org.abraracourcix.alipes.common.Event; |
|
9 |
| import org.abraracourcix.alipes.listeners.filter.EventFilterListener; |
|
10 |
| import org.abraracourcix.alipes.listeners.logging.ConsoleListener; |
|
11 |
| import org.abraracourcix.alipes.listeners.status.StatusFrame; |
|
12 |
| import org.abraracourcix.alipes.listeners.status.StatusListener; |
|
13 |
| import org.abraracourcix.alipes.monitors.url.URLEvent; |
|
14 |
| import org.abraracourcix.alipes.monitors.url.URLMonitor; |
|
15 |
| import org.abraracourcix.alipes.pipes.Multiplexor; |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| public final class CommonHostsJDTAlerter { |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
0
| private CommonHostsJDTAlerter() {
|
|
28 |
| } |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
0
| public static void main(final String[] args)
|
|
40 |
| throws MalformedURLException, InterruptedException { |
|
41 |
0
| System.out.println("Hit ctrl-C when you get bored");
|
|
42 |
0
| Event[] events =
|
|
43 |
| { URLEvent.DOWN, URLEvent.GONE_DOWN, URLEvent.GONE_UP }; |
|
44 |
0
| Multiplexor multiplex = new Multiplexor();
|
|
45 |
0
| EventFilterListener filterAndConsole =
|
|
46 |
| new EventFilterListener( |
|
47 |
| new ConsoleListener(), |
|
48 |
| events, |
|
49 |
| EventFilterListener.FilterType.INCLUDED); |
|
50 |
0
| multiplex.addListener(filterAndConsole);
|
|
51 |
0
| URLMonitor mon =
|
|
52 |
| new URLMonitor( |
|
53 |
| multiplex, |
|
54 |
| 5, |
|
55 |
| new URL("http://uml01.astrogrid.org:8080")); |
|
56 |
0
| mon.addNewURL(new URL("http://vm05.astrogrid.org:8080"));
|
|
57 |
0
| mon.addNewURL(new URL("http://vm06.astrogrid.org:8080"));
|
|
58 |
0
| mon.addNewURL(new URL("http://vm07.astrogrid.org:8080"));
|
|
59 |
0
| mon.addNewURL(new URL("http://localhost:8080"));
|
|
60 |
0
| mon.start();
|
|
61 |
0
| StatusFrame frame = new StatusFrame();
|
|
62 |
0
| StatusListener statusListener = new StatusListener(frame);
|
|
63 |
0
| frame.registerStatusListener(statusListener);
|
|
64 |
0
| frame.show();
|
|
65 |
0
| multiplex.addListener(statusListener);
|
|
66 |
0
| Thread.sleep(60 * 10 * 1000);
|
|
67 |
| } |
|
68 |
| } |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |