dlmarion commented on a change in pull request #1818:
URL: https://github.com/apache/accumulo/pull/1818#discussion_r556689854



##########
File path: 
core/src/main/java/org/apache/accumulo/core/classloader/DefaultContextClassLoaderFactory.java
##########
@@ -55,22 +56,21 @@ public DefaultContextClassLoaderFactory(final 
AccumuloConfiguration accConf) {
         () -> 
accConf.getAllPropertiesWithPrefix(Property.VFS_CONTEXT_CLASSPATH_PROPERTY);
     AccumuloVFSClassLoader.setContextConfig(contextConfigSupplier);
     LOG.debug("ContextManager configuration set");
-    startCleanupThread(contextConfigSupplier);
+    startCleanupThread(accConf, contextConfigSupplier);
   }
 
-  private static void startCleanupThread(final Supplier<Map<String,String>> 
contextConfigSupplier) {
-    new Timer(className + "-cleanup", true).scheduleAtFixedRate(new 
TimerTask() {
-      @Override
-      public void run() {
-        Map<String,String> contextConfigs = contextConfigSupplier.get();
-        LOG.trace("{}-cleanup thread, properties: {}", className, 
contextConfigs);
-        int prefixlen = 
Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey().length();
-        Set<String> contextsInUse = contextConfigs.keySet().stream()
-            .map(k -> k.substring(prefixlen)).collect(Collectors.toSet());
-        LOG.trace("{}-cleanup thread, contexts in use: {}", className, 
contextsInUse);
-        AccumuloVFSClassLoader.removeUnusedContexts(contextsInUse);
-      }
-    }, 60_000, 60_000);
+  private static void startCleanupThread(final AccumuloConfiguration conf,
+      final Supplier<Map<String,String>> contextConfigSupplier) {
+    ThreadPools.createGeneralScheduledExecutorService(conf)
+        .scheduleWithFixedDelay(Threads.createNamedRunnable(className + 
"-cleanup", () -> {
+          LOG.trace("{}-cleanup thread, properties: {}", className, conf);
+          Set<String> contextsInUse = 
contextConfigSupplier.get().keySet().stream()
+              .filter(k -> 
k.startsWith(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.name()))

Review comment:
       Thanks for catching that, I went down one path, then another, and left 
that in by mistake. Resolved in latest commit.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to