gaozhangmin commented on a change in pull request #14346:
URL: https://github.com/apache/pulsar/pull/14346#discussion_r809725074



##########
File path: 
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/functioncache/FunctionCacheManagerImpl.java
##########
@@ -73,39 +71,37 @@ public void registerFunctionInstance(String fid,
             throw new NullPointerException("FunctionID not set");
         }
 
-        synchronized (cacheFunctions) {
-            FunctionCacheEntry entry = cacheFunctions.get(fid);
+        FunctionCacheEntry entry = cacheFunctions.get(fid);
 
-            if (null == entry) {
-                URL[] urls = new URL[requiredJarFiles.size() + 
requiredClasspaths.size()];
-                int count = 0;
-                try {
-                    // add jar files to urls
-                    for (String jarFile : requiredJarFiles) {
-                        urls[count++] = new File(jarFile).toURI().toURL();
-                    }
+        if (null == entry) {
+            URL[] urls = new URL[requiredJarFiles.size() + 
requiredClasspaths.size()];
+            int count = 0;
+            try {
+                // add jar files to urls
+                for (String jarFile : requiredJarFiles) {
+                    urls[count++] = new File(jarFile).toURI().toURL();
+                }
 
-                    // add classpaths
-                    for (URL url : requiredClasspaths) {
-                        urls[count++] = url;
-                    }
+                // add classpaths
+                for (URL url : requiredClasspaths) {
+                    urls[count++] = url;
+                }
 
-                    cacheFunctions.put(
+                cacheFunctions.put(
                         fid,
                         new FunctionCacheEntry(
-                            requiredJarFiles,
-                            requiredClasspaths,
-                            urls,
-                            eid, rootClassLoader));
-                } catch (Throwable cause) {
-                    Exceptions.rethrowIOException(cause);
-                }

Review comment:
       @BewareMyPower  pTAL

##########
File path: 
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/functioncache/FunctionCacheManagerImpl.java
##########
@@ -116,43 +112,35 @@ public void registerFunctionInstanceWithArchive(String 
fid, String eid,
             throw new NullPointerException("FunctionID not set");
         }
 
-        synchronized (cacheFunctions) {
-            FunctionCacheEntry entry = cacheFunctions.get(fid);
+        FunctionCacheEntry entry = cacheFunctions.get(fid);
 
-            if (null != entry) {
-                entry.register(eid, Collections.singleton(narArchive), 
Collections.emptyList());
-                return;
-            }
+        if (null != entry) {
+            entry.register(eid, Collections.singleton(narArchive), 
Collections.emptyList());
+            return;
+        }
 
-            // Create new cache entry
-            try {
-                cacheFunctions.put(fid, new FunctionCacheEntry(narArchive, 
eid, rootClassLoader, narExtractionDirectory));
-            } catch (Throwable cause) {
-                Exceptions.rethrowIOException(cause);
-            }
+        // Create new cache entry
+        try {
+            cacheFunctions.put(fid, new FunctionCacheEntry(narArchive, eid, 
rootClassLoader, narExtractionDirectory));
+        } catch (Throwable cause) {
+            Exceptions.rethrowIOException(cause);
         }

Review comment:
       @BewareMyPower pTAL




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