showuon commented on a change in pull request #11405:
URL: https://github.com/apache/kafka/pull/11405#discussion_r732434973



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/errors/StreamsException.java
##########
@@ -25,15 +28,45 @@
 
     private final static long serialVersionUID = 1L;
 
+    private TaskId taskId = null;
+
     public StreamsException(final String message) {
         super(message);
     }
 
+    public StreamsException(final String message, final TaskId taskId) {
+        this(message);
+        this.taskId = taskId;
+    }

Review comment:
       nit: Usually we do the constructor overloading in the opposite way, that 
is, the constructor with less parameters calls the other one. ex:
   ```java
   public StreamsException(final String message) {
           this(message, null);
       }
   
       public StreamsException(final String message, final TaskId taskId) {
           super(message);
           this.taskId = taskId;
       }
   ```
   Just for readability :)

##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java
##########
@@ -900,9 +903,13 @@ void closeAndCleanUpTasks(final Collection<Task> 
activeTasks, final Collection<T
             } catch (final TaskMigratedException e) {
                 // just ignore the exception as it doesn't matter during 
shutdown
                 tasksToCloseDirty.add(task);
-            } catch (final RuntimeException e) {
+            } catch (final StreamsException e) {
+                e.setTaskId(task.id());
                 firstException.compareAndSet(null, e);
                 tasksToCloseDirty.add(task);
+            } catch (final RuntimeException e) {
+                firstException.compareAndSet(null, new StreamsException(e, 
task.id()));
+                tasksToCloseDirty.add(task);

Review comment:
       nit: Looks like we do `tasksToCloseDirty.add(task);` in each case, could 
we put it int the `finally` block?

##########
File path: 
streams/src/main/java/org/apache/kafka/streams/errors/StreamsException.java
##########
@@ -25,15 +28,45 @@
 
     private final static long serialVersionUID = 1L;
 
+    private TaskId taskId = null;
+
     public StreamsException(final String message) {
         super(message);
     }
 
+    public StreamsException(final String message, final TaskId taskId) {
+        this(message);
+        this.taskId = taskId;
+    }

Review comment:
       Same comments to below constructors.




-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to