### Question:
HelixTaskExecutor implements MessageListener, TaskExecutor { @Override public void shutdown() { LOG.info("Shutting down HelixTaskExecutor"); _isShuttingDown = true; _timer.cancel(); reset(); _monitor.shutDown(); LOG.info("Shutdown HelixTaskExecutor finished"); } HelixTaskExecutor();  HelixTaskExecutor(ParticipantStatusMonitor participantStatusMonitor);  HelixTaskExecutor(ParticipantStatusMonitor participantStatusMonitor,
      MessageQueueMonitor messageQueueMonitor); @Override void registerMessageHandlerFactory(String type, MessageHandlerFactory factory); @Override void registerMessageHandlerFactory(String type, MessageHandlerFactory factory,
      int threadpoolSize); void setController(GenericHelixController controller); ParticipantStatusMonitor getParticipantMonitor(); @Override List<Future<HelixTaskResult>> invokeAllTasks(List<MessageTask> tasks, long timeout,
      TimeUnit unit); @Override boolean cancelTimeoutTask(MessageTask task); @Override boolean scheduleTask(MessageTask task); @Override boolean cancelTask(MessageTask task); @Override void finishTask(MessageTask task); @Override @PreFetch(enabled = false) void onMessage(String instanceName, List<Message> messages,
      NotificationContext changeContext); MessageHandler createMessageHandler(Message message, NotificationContext changeContext); @Override void shutdown(); static final int DEFAULT_PARALLEL_TASKS; static final String MAX_THREADS; }### Answer:
@Test() public void testShutdown() throws InterruptedException { System.out.println("START TestCMTaskExecutor.testShutdown()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); TestMessageHandlerFactory factory = new TestMessageHandlerFactory(); for (String type : factory.getMessageTypes()) { executor.registerMessageHandlerFactory(type, factory); } TestMessageHandlerFactory2 factory2 = new TestMessageHandlerFactory2(); for (String type : factory2.getMessageTypes()) { executor.registerMessageHandlerFactory(type, factory2); } CancellableHandlerFactory factory3 = new CancellableHandlerFactory(); for (String type : factory3.getMessageTypes()) { executor.registerMessageHandlerFactory(type, factory3); } int nMsg1 = 10, nMsg2 = 10, nMsg3 = 10; List<Message> msgList = new ArrayList<Message>(); for (int i = 0; i < nMsg1; i++) { Message msg = new Message(factory.getMessageTypes().get(0), UUID.randomUUID().toString()); msg.setTgtSessionId("*"); msg.setTgtName("Localhost_1123"); msg.setSrcName("127.101.1.23_2234"); msgList.add(msg); } for (int i = 0; i < nMsg2; i++) { Message msg = new Message(factory2.getMessageTypes().get(0), UUID.randomUUID().toString()); msg.setTgtSessionId("*"); msgList.add(msg); msg.setTgtName("Localhost_1123"); msg.setSrcName("127.101.1.23_2234"); msgList.add(msg); } for (int i = 0; i < nMsg3; i++) { Message msg = new Message(factory3.getMessageTypes().get(0), UUID.randomUUID().toString()); msg.setTgtSessionId("*"); msgList.add(msg); msg.setTgtName("Localhost_1123"); msg.setSrcName("127.101.1.23_2234"); msgList.add(msg); } NotificationContext changeContext = new NotificationContext(manager); changeContext.setChangeType(HelixConstants.ChangeType.MESSAGE); executor.onMessage("some", msgList, changeContext); Thread.sleep(500); for (ExecutorService svc : executor._executorMap.values()) { Assert.assertFalse(svc.isShutdown()); } Assert.assertTrue(factory._processedMsgIds.size() > 0); executor.shutdown(); for (ExecutorService svc : executor._executorMap.values()) { Assert.assertTrue(svc.isShutdown()); } System.out.println("END TestCMTaskExecutor.testShutdown()"); }