--- experimental/server/SampleConfigObtainer/SampleConfigObtainer.java 2000/11/08 21:24:33 1.1 +++ experimental/server/SampleConfigObtainer/SampleConfigObtainer.java 2000/11/13 16:11:03 1.2 @@ -8,8 +8,8 @@ import org.omg.CosNaming.*; /** * A quick class to test the Configurator and Configuration implementations * - * @author $Author: ajm $ - * @version $Id: SampleConfigObtainer.java,v 1.1 2000/11/08 21:24:33 ajm Exp $ + * @author $Author: tdb $ + * @version $Id: SampleConfigObtainer.java,v 1.2 2000/11/13 16:11:03 tdb Exp $ */ class SampleConfigObtainer { @@ -18,7 +18,7 @@ class SampleConfigObtainer { /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.1 $"; + public static final String REVISION = "$Revision: 1.2 $"; //---STATIC METHODS--- @@ -72,6 +72,26 @@ class SampleConfigObtainer { } } + System.out.println("Testing configuration change system."); + System.out.println("Waiting for configuration change on 1 second intervals"); + + // get our last modified + long myLastModified = myConfig.getLastModified(); + + // get a ref to the last modified of file NOW... + boolean changed = configurator.isModified(config,myLastModified); + + // keep checking, every second until it changes + while (!changed) { + Thread.sleep(1000); + changed = configurator.isModified(config,myLastModified); + } + + // get the config again and print out the new time to compare - just to check ;-) + myConfig = configurator.getConfiguration(config); + System.out.println("Configuration changed: " + myLastModified + " -> " + myConfig.getLastModified()); + + // done testing System.out.println("Finished"); } catch (Exception e) {