pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject [incubator-pulsar] branch branch-2.1 updated: Set correct exception if function runnable fails with Error (#2353)
Date Mon, 27 Aug 2018 09:19:17 GMT
This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 7a0ca5a  Set correct exception if function runnable fails with Error (#2353)
7a0ca5a is described below

commit 7a0ca5ae1be8d03828ef224350576755fa5f8af9
Author: Rajan Dhabalia <rdhabalia@apache.org>
AuthorDate: Mon Aug 13 21:20:02 2018 -0700

    Set correct exception if function runnable fails with Error (#2353)
    
    * Set correct exception if function runnable fails with Error
    
    * fix throwable set
---
 .../org/apache/pulsar/functions/instance/JavaInstanceRunnable.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
index b64224f..68df84a 100644
--- a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
+++ b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
@@ -181,8 +181,10 @@ public class JavaInstanceRunnable implements AutoCloseable, Runnable
{
      */
     @Override
     public void run() {
+        String functionName = null;
         try {
             ContextImpl contextImpl = setupContext();
+            functionName = String.format("%s-%s", contextImpl.getTenant(), contextImpl.getFunctionName());
             javaInstance = setupJavaInstance(contextImpl);
             if (null != stateTable) {
                 StateContextImpl stateContext = new StateContextImpl(stateTable);
@@ -229,8 +231,8 @@ public class JavaInstanceRunnable implements AutoCloseable, Runnable {
                 }
             }
         } catch (Throwable t) {
-            log.error("Uncaught exception in Java Instance", t);
-            deathException = (Exception) t;
+            log.error("[{}] Uncaught exception in Java Instance", functionName, t);
+            deathException = t;
             return;
         } finally {
             log.info("Closing instance");


Mime
View raw message