@@ -338,19 +338,20 @@ public Throwable wrapFailure(ActivityTask t, Throwable failure) {
338338 }
339339
340340 /**
341- * Executes a gRPC call with proper interrupted flag handling. This method temporarily clears
342- * the interrupted flag before making gRPC calls and restores it afterward to ensure gRPC calls
343- * succeed even when the thread has been interrupted.
341+ * Executes a gRPC call with proper interrupted flag handling.
342+ * Activities that return with the 'interrupted' flag set, were unable to report their completion to the server.
343+ * We need to clear 'interrupted' flag to allow gRPC calls to succeed,then restore it after reporting completion,
344+ * to ensure gRPC calls succeed even when the thread has been interrupted.
344345 *
345346 * @param grpcCall the gRPC call to execute
346347 * @see <a href="https://github.com/temporalio/sdk-java/issues/731">GitHub Issue #731</a>
347348 */
348349 private void executeGrpcCallWithInterruptHandling (Runnable grpcCall ) {
349350 // Check if the current thread is interrupted before making gRPC calls
350- // If it is, we need to temporarily clear the flag to allow gRPC calls to succeed,then restore it after reporting.
351+ // If it is, we need to clear the flag to allow gRPC calls to succeed,then restore it after reporting.
351352 // This handles the case where an activity catches InterruptedException, restores the interrupted flag,
352353 // and continues to return a result.
353- // See: https://github.com/temporalio/sdk-java/issues/731
354+
354355 boolean wasInterrupted = Thread .interrupted (); // This clears the flag
355356 try {
356357 grpcCall .run ();
0 commit comments