@Override public NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Override public synchronized NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public synchronized NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public synchronized NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public NetworkHealthCheck setPeriod(long period) { super.setPeriod(period); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Override public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) { this.checkTimeNanoSeconds = unit.toNanos(timeout); this.scheduledComponent.setPeriod(timeout, unit); return this; }
@Test public void testUsingOwnExecutors() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final ActiveMQScheduledComponent local = new ActiveMQScheduledComponent(10, TimeUnit.MILLISECONDS, false) { @Override public void run() { latch.countDown(); } }; local.start(); local.start(); // should be ok to call start again try { Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); // re-scheduling the executor at a big interval.. // just to make sure it won't hung local.setTimeUnit(TimeUnit.HOURS); local.setPeriod(1); } finally { local.stop(); local.stop(); // should be ok to call stop again } }
@Test public void testUsingOwnExecutorsOnDemand() throws Throwable { final ReusableLatch latch = new ReusableLatch(1); final ActiveMQScheduledComponent local = new ActiveMQScheduledComponent(10, TimeUnit.MILLISECONDS, true) { @Override public void run() { latch.countDown(); } }; local.start(); local.start(); // should be ok to call start again try { Assert.assertFalse(latch.await(20, TimeUnit.MILLISECONDS)); local.delay(); Assert.assertTrue(latch.await(20, TimeUnit.MILLISECONDS)); latch.setCount(1); Assert.assertFalse(latch.await(20, TimeUnit.MILLISECONDS)); // re-scheduling the executor at a big interval.. // just to make sure it won't hung local.setTimeUnit(TimeUnit.HOURS); local.setPeriod(1); } finally { local.stop(); local.stop(); // calling stop again should not be an issue. } }