AbstractClusterShardPeriodicTask extends AbstractStartStoppable implements Releasable, Startable, Stoppable { @Override public void release() throws Exception { stop(); } AbstractClusterShardPeriodicTask(String clusterId, String shardId, DcMetaCache dcMetaCache,
                                            CurrentMetaManager currentMetaManager, ScheduledExecutorService scheduled); @Override void release(); @Override String toString(); static final int DEFAULT_WORK_INTERVAL_SECONDS; }
@Test public void testRelease() throws Exception { task.start(); int stopTimes = 10; try { for(int i = 0; i < stopTimes; i++) { task.release(); } } catch (Exception ignore) { } verify(task, times(1)).doStop(); Assert.assertEquals(1, counter.get()); }