tillrohrmann commented on a change in pull request #11963:
URL: https://github.com/apache/flink/pull/11963#discussion_r420655663



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java
##########
@@ -48,133 +48,46 @@
  * Provides facilities to download a set of libraries (typically JAR files) 
for a job from a
  * {@link PermanentBlobService} and create a class loader with references to 
them.
  */
+@ThreadSafe
 public class BlobLibraryCacheManager implements LibraryCacheManager {
 
        private static final Logger LOG = 
LoggerFactory.getLogger(BlobLibraryCacheManager.class);
 
-       private static final ExecutionAttemptID JOB_ATTEMPT_ID = new 
ExecutionAttemptID(-1, -1);
-
        // 
--------------------------------------------------------------------------------------------
 
        /** The global lock to synchronize operations. */
        private final Object lockObject = new Object();
 
        /** Registered entries per job. */
+       @GuardedBy("lockObject")
        private final Map<JobID, LibraryCacheEntry> cacheEntries = new 
HashMap<>();
 
        /** The blob service to download libraries. */
+       @GuardedBy("lockObject")
        private final PermanentBlobService blobService;
 
-       /** The resolve order to use when creating a {@link ClassLoader}. */
-       private final FlinkUserCodeClassLoaders.ResolveOrder 
classLoaderResolveOrder;
-
-       /**
-        * List of patterns for classes that should always be resolved from the 
parent ClassLoader,
-        * if possible.
-        */
-       private final String[] alwaysParentFirstPatterns;
+       private final ClassLoaderFactory classLoaderFactory;
 
        // 
--------------------------------------------------------------------------------------------
 
        public BlobLibraryCacheManager(
                        PermanentBlobService blobService,
-                       FlinkUserCodeClassLoaders.ResolveOrder 
classLoaderResolveOrder,
-                       String[] alwaysParentFirstPatterns) {
+                       ClassLoaderFactory classLoaderFactory) {
                this.blobService = checkNotNull(blobService);
-               this.classLoaderResolveOrder = 
checkNotNull(classLoaderResolveOrder);
-               this.alwaysParentFirstPatterns = alwaysParentFirstPatterns;
+               this.classLoaderFactory = checkNotNull(classLoaderFactory);
        }
 
        @Override
-       public void registerJob(JobID id, Collection<PermanentBlobKey> 
requiredJarFiles, Collection<URL> requiredClasspaths)
-               throws IOException {
-               registerTask(id, JOB_ATTEMPT_ID, requiredJarFiles, 
requiredClasspaths);
-       }
-
-       @Override
-       public void registerTask(
-               JobID jobId,
-               ExecutionAttemptID task,
-               @Nullable Collection<PermanentBlobKey> requiredJarFiles,
-               @Nullable Collection<URL> requiredClasspaths) throws 
IOException {
-
-               checkNotNull(jobId, "The JobId must not be null.");
-               checkNotNull(task, "The task execution id must not be null.");
-
-               if (requiredJarFiles == null) {
-                       requiredJarFiles = Collections.emptySet();
-               }
-               if (requiredClasspaths == null) {
-                       requiredClasspaths = Collections.emptySet();
-               }
-
+       public ClassLoaderLease registerClassLoaderLease(JobID jobId) {
                synchronized (lockObject) {
-                       LibraryCacheEntry entry = cacheEntries.get(jobId);
+                       LibraryCacheEntry libraryCacheEntry = 
cacheEntries.get(jobId);

Review comment:
       Jup, you are right. This is nicer. Will update it.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to