@Test public void testStop() { MyPeriodicWatch watch = new MyPeriodicWatch("watch"); watch.start(); watch.setPeriod(500); Utils.sleep(5000); watch.stop(); Assert.assertTrue(watch.log().length() >= 8); Assert.assertTrue(watch.log().length() <= 12); watch.log().delete(0, watch.log().length()); Utils.sleep(2000); Assert.assertTrue(watch.log().length() == 0); watch.stop(); Utils.sleep(2000); Assert.assertTrue(watch.log().length() == 0); watch.start(); Utils.sleep(5000); for (int i = 0; i < 100; i++) { watch.stop(); } Assert.assertTrue(watch.log().length() >= 8); Assert.assertTrue(watch.log().length() <= 12); watch.log().delete(0, watch.log().length()); for (int i = 0; i < 1000; i++) { watch.stop(); } Utils.close(watch.getWatchDataSource()); }
public void stop() { if(watchTimer != null) watchTimer.cancel(); }
PeriodicWatch extends ThresholdWatch implements PeriodicWatchMBean { public void stop() { if(watchTimer != null) watchTimer.cancel(); } }
PeriodicWatch extends ThresholdWatch implements PeriodicWatchMBean { public void stop() { if(watchTimer != null) watchTimer.cancel(); } PeriodicWatch(String id);  PeriodicWatch(String id, Configuration config);  PeriodicWatch(WatchDataSource watchDataSource, String id); }
PeriodicWatch extends ThresholdWatch implements PeriodicWatchMBean { public void stop() { if(watchTimer != null) watchTimer.cancel(); } PeriodicWatch(String id);  PeriodicWatch(String id, Configuration config);  PeriodicWatch(WatchDataSource watchDataSource, String id); void start(); void stop(); long getPeriod(); void setPeriod(long newPeriod); }
PeriodicWatch extends ThresholdWatch implements PeriodicWatchMBean { public void stop() { if(watchTimer != null) watchTimer.cancel(); } PeriodicWatch(String id);  PeriodicWatch(String id, Configuration config);  PeriodicWatch(WatchDataSource watchDataSource, String id); void start(); void stop(); long getPeriod(); void setPeriod(long newPeriod); static final long DEFAULT_PERIOD; }