title: The web application appears to have started a thread named [Timer-0] but has failed to stop it
body: <p>I am using Spring Boot 1.5.9.RELEASE + Java 8 + Tomcat 9
  + Jersey + Oracle and my app has scheduled method defined as follows:</p>
  
  <pre><code>@Configuration
  @EnableScheduling
  public class ScheduleConfig implements SchedulingConfigurer {
  
      @Override
      public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
          taskRegistrar.setScheduler(taskExecutor());
      }
  
      @Bean(destroyMethod = "shutdown")
      public Executor taskExecutor() {
          return Executors.newScheduledThreadPool(100);
      }
  }
  </code></pre>
  
  <p>The job class:</p>
  
  <pre><code>@Component
  public class ClearCacheJob {
  
  
  
      @Scheduled(fixedRate = 3600000, initialDelay = 10000)
      public void clearErrorCodesCache() {
          try {
              logger.info("######## ClearCacheJob #########");
          } catch (Exception e) {
              logger.error("Exception in ClearCacheJob", e);
          }
      }
  
  }
  </code></pre>
  
  <p>Also I have a class to deregister the Oracle driver as follows:</p>
  
  <pre><code>@WebListener
  public class ContainerContextClosedHandler implements ServletContextListener {
  
      private static final Logger logger = LoggerFactory.getLogger(ContainerContextClosedHandler.class);
  
      @Override
      public void contextInitialized(ServletContextEvent servletContextEvent) {
          logger.info("######### contextInitialized #########");
      }
  
      @Override
      public void contextDestroyed(ServletContextEvent servletContextEvent) {
          logger.info("######### contextDestroyed #########");
          Enumeration&lt;Driver&gt; drivers = DriverManager.getDrivers();
          while (drivers.hasMoreElements()) {
              Driver driver = drivers.nextElement();
              try {
                  DriverManager.deregisterDriver(driver);
                  logger.info(String.format("deregistering jdbc driver: %s", driver));
              } catch (SQLException e) {
                  logger.info(String.format("Error deregistering driver %s", driver), e);
              }
  
          }
      }
  
  }
  </code></pre>
  
  <p>but when stopping Tomcat I am getting the following error:</p>
  
  <pre><code>WARNING [Thread-11] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [hai] 
  appears to have started a thread named [Timer-0] but has failed to stop it. 
   This is very likely to create a memory leak. Stack trace of thread:
   java.lang.Object.wait(Native Method)
   java.lang.Object.wait(Unknown Source)
   java.util.TimerThread.mainLoop(Unknown Source)
   java.util.TimerThread.run(Unknown Source)
  </code></pre>
  
  <p>Why am I getting this error and how can I fix it?</p>