pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rdhabalia commented on a change in pull request #2502: Fix Handling of user defined nar sources/sinks
Date Sat, 01 Sep 2018 00:56:14 GMT
rdhabalia commented on a change in pull request #2502: Fix Handling of user defined nar sources/sinks
URL: https://github.com/apache/incubator-pulsar/pull/2502#discussion_r214499935
 
 

 ##########
 File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
 ##########
 @@ -246,12 +246,12 @@ public void run() {
 
     private void loadJars() throws Exception {
 
-        if (jarFile.endsWith(".nar")) {
-            // The functions code is contained in a NAR archive
+        try {
+            // Let's first try to treat it as a nar archive
             fnCache.registerFunctionInstanceWithArchive(instanceConfig.getFunctionId(), instanceConfig.getInstanceId(),
                     jarFile);
-        } else {
-            log.info("Loading JAR files for function {} from archive {}", instanceConfig,
jarFile);
+        } catch (Exception e) {
+            log.info("For Function {} Loading as NAR failed with {}; treating it as Jar instead",
instanceConfig, e);
 
 Review comment:
   i mean now, this change identifies it as a jar if `fnCache.registerFunctionInstanceWithArchive`
throws exception. so, just wanted to check if we can test with real jar file and see `fnCache.registerFunctionInstanceWithArchive`
 is actually throwing exception or eating up internally. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message