use of com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState in project jdk8u_jdk by JetBrains.
the class DirectoryScannerTest method testGetState.
/**
* Test of getState method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
*/
public void testGetState() {
System.out.println("getState");
final DirectoryScannerConfig bean = new DirectoryScannerConfig("test");
bean.setRootDirectory(System.getProperty("java.io.tmpdir"));
final ResultLogManager log = new ResultLogManager();
DirectoryScanner instance = new DirectoryScanner(bean, log);
ScanState expResult = STOPPED;
ScanState result = instance.getState();
assertEquals(STOPPED, result);
instance.scan();
result = instance.getState();
assertEquals(COMPLETED, result);
}
use of com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState in project jdk8u_jdk by JetBrains.
the class DirectoryScanner method setStateAndNotify.
// Switch this object state to the desired value an send
// a notification. Don't call this method from within a
// synchronized block!
//
private final void setStateAndNotify(ScanState desired) {
final ScanState old = state;
if (old == desired)
return;
state = desired;
final AttributeChangeNotification n = new AttributeChangeNotification(this, getNextSeqNumber(), System.currentTimeMillis(), "state change", "State", ScanState.class.getName(), String.valueOf(old), String.valueOf(desired));
broadcaster.sendNotification(n);
}
Aggregations