1 package com.explosion.expfmodules.monitoring;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import org.apache.log4j.LogManager;
24 import org.apache.log4j.Logger;
25
26 import com.explosion.utilities.exception.ExceptionManagerFactory;
27 import com.explosion.utilities.process.StackableSimpleProcess;
28 import com.explosion.utilities.process.threads.Updateable;
29
30 /***
31 * @author Stephen Cowx Date created:@14-Feb-2003
32 */
33 public class SystemMonitoringProcess extends StackableSimpleProcess
34 {
35
36 private static Logger log = LogManager.getLogger(SystemMonitoringProcess.class);
37 private long interval = 1000;
38
39 /***
40 * Constructor for SystemMonitoringProcess.
41 */
42 public SystemMonitoringProcess(Updateable updateable)
43 {
44 super(updateable, null);
45 this.setIsUserProcess(true);
46 }
47
48 public void process()
49 {
50 try
51 {
52 while (!this.isStopped())
53 {
54 this.setPercentComplete(0);
55 this.setStatusText("Monitoring system");
56 getUpdateable().update(null);
57 Thread.sleep(interval);
58 }
59 } catch (Exception e)
60 {
61 ExceptionManagerFactory.getExceptionManager().manageException(e, null);
62 setStatusText("Monitoring aborted");
63 setPercentComplete(100);
64 }
65 }
66 }