ctubbsii commented on code in PR #35:
URL: 
https://github.com/apache/accumulo-classloaders/pull/35#discussion_r2628538684


##########
modules/local-caching-classloader/src/main/java/org/apache/accumulo/classloader/lcc/cache/CacheUtils.java:
##########
@@ -126,4 +146,101 @@ public static LockInfo lockContextCacheDir(final Path 
contextCacheDir)
     }
   }
 
+  public static URLClassLoaderHelper stageContext(final Path baseCacheDir,
+      final ContextDefinition contextDefinition)
+      throws IOException, ContextClassLoaderException, InterruptedException, 
URISyntaxException {
+    final RetryFactory retryFactory =
+        Retry.builder().infiniteRetries().retryAfter(1, TimeUnit.SECONDS)
+            .incrementBy(1, TimeUnit.SECONDS).maxWait(5, 
TimeUnit.MINUTES).backOffFactor(2)
+            .logInterval(1, TimeUnit.SECONDS).createFactory();
+    requireNonNull(contextDefinition, "definition must be supplied");
+    CacheUtils.createBaseDirs(baseCacheDir);
+    Path contextsDir = CacheUtils.contextsDir(baseCacheDir);
+    final Set<File> localFiles = new LinkedHashSet<>();
+    try {
+      LockInfo lockInfo = CacheUtils.lockContextCacheDir(contextsDir);
+      Files.write(
+          contextsDir
+              .resolve(contextDefinition.getContextName() + "_" + 
contextDefinition.getChecksum()),
+          contextDefinition.toJson().getBytes(UTF_8));

Review Comment:
   This is going to change anyway. Writing these context files locally doesn't 
need the lock. We only need a lock per resource file (jar) when downloading 
those.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to