72 |
|
} |
73 |
|
} |
74 |
|
|
75 |
+ |
System.out.println("Testing configuration change system."); |
76 |
+ |
System.out.println("Waiting for configuration change on 1 second intervals"); |
77 |
+ |
|
78 |
+ |
// get our last modified |
79 |
+ |
long myLastModified = myConfig.getLastModified(); |
80 |
+ |
|
81 |
+ |
// get a ref to the last modified of file NOW... |
82 |
+ |
boolean changed = configurator.isModified(config,myLastModified); |
83 |
+ |
|
84 |
+ |
// keep checking, every second until it changes |
85 |
+ |
while (!changed) { |
86 |
+ |
Thread.sleep(1000); |
87 |
+ |
changed = configurator.isModified(config,myLastModified); |
88 |
+ |
} |
89 |
+ |
|
90 |
+ |
// get the config again and print out the new time to compare - just to check ;-) |
91 |
+ |
myConfig = configurator.getConfiguration(config); |
92 |
+ |
System.out.println("Configuration changed: " + myLastModified + " -> " + myConfig.getLastModified()); |
93 |
+ |
|
94 |
+ |
// done testing |
95 |
|
System.out.println("Finished"); |
96 |
|
|
97 |
|
} catch (Exception e) { |