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



##########
File path: 
core/src/main/java/org/apache/accumulo/core/classloader/DefaultContextClassLoaderFactory.java
##########
@@ -59,18 +60,20 @@ public DefaultContextClassLoaderFactory(final 
AccumuloConfiguration accConf) {
   }
 
   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);
+    final ConfigurationCopy cc = new 
ConfigurationCopy(contextConfigSupplier.get());
+    String size = cc.get(Property.GENERAL_SIMPLETIMER_THREADPOOL_SIZE);
+    if (null == size || size.isEmpty()) {
+      cc.set(Property.GENERAL_SIMPLETIMER_THREADPOOL_SIZE,
+          Property.GENERAL_SIMPLETIMER_THREADPOOL_SIZE.getDefaultValue());
+    }

Review comment:
       IIRC this was specific to the issue of the property not being in the 
Map<String,String> from which the ConfigurationCopy is based upon *and* the 
fact that ConfigurationCopy does not provide the default value in get(Property) 
but all of the other implementations do. Putting it here resolved this specific 
issue. I could move it into `ThreadPools.getGeneralScheduledExecutorService` 
but it would not be used for the most part. I'm indifferent, I can move it if 
we have others that think it's a good idea.




----------------------------------------------------------------
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