### Question:
AsyncHashedWheelTimer extends HashedWheelTimer { @Override public Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) { return super.newTimeout(new AsyncTimerTask(task), delay, unit); } AsyncHashedWheelTimer(ThreadFactory threadFactory, long tickDuration, TimeUnit unit,
                                 int ticksPerWheel, int threadSize, int queueSize,
                                 ThreadFactory asyncThreadFactory,
                                 TaskFailedCallback taskFailedCallback);  AsyncHashedWheelTimer(ThreadFactory threadFactory, long tickDuration, TimeUnit unit,
                                 int ticksPerWheel, Executor asyncExecutor,
                                 TaskFailedCallback taskFailedCallback); @Override Timeout newTimeout(TimerTask task, long delay, TimeUnit unit);  }### Answer:
@Test public void doTest() throws InterruptedException { CountDownLatch countDownLatch = new CountDownLatch(2); ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder(); threadFactoryBuilder.setDaemon(true); final Timer timer = new AsyncHashedWheelTimer(threadFactoryBuilder.setNameFormat( "AsyncHashedWheelTimerTest").build(), 50, TimeUnit.MILLISECONDS, 10, 5, 10, threadFactoryBuilder.setNameFormat("Registry-DataNodeServiceImpl-WheelExecutor-%d") .build(), new AsyncHashedWheelTimer.TaskFailedCallback() { @Override public void executionRejected(Throwable t) { executionRejectedThrowable = t; } @Override public void executionFailed(Throwable t) { executionFailedThrowable = t; countDownLatch.countDown(); } }); currentTime = System.currentTimeMillis(); executeTime = currentTime; timer.newTimeout((timeout)-> { executeTime = System.currentTimeMillis(); countDownLatch.countDown(); throw new Exception("execution failed."); },1000, TimeUnit.MILLISECONDS); countDownLatch.await(3000, TimeUnit.MILLISECONDS); Assert.assertTrue(executeTime >= currentTime + 1000); Assert.assertNull(executionRejectedThrowable); Assert.assertNotNull(executionFailedThrowable); }