This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 41835690a45 [fix][fn] Fix graceful Pulsar Function shutdown so that
consumers and producers are closed (#25157)
41835690a45 is described below
commit 41835690a45f48978734c86406d1e6d79a7c7ba6
Author: Lari Hotari <[email protected]>
AuthorDate: Fri Jan 16 15:54:59 2026 +0200
[fix][fn] Fix graceful Pulsar Function shutdown so that consumers and
producers are closed (#25157)
(cherry picked from commit 0bf560fc0cacf75a31723fe96ecd48f6c1e3383b)
---
.../java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java | 2 ++
1 file changed, 2 insertions(+)
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 4f811c14704..1cfbd599bd6 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
@@ -383,6 +383,8 @@ public class JavaInstanceRunnable implements AutoCloseable,
Runnable {
if (stats != null) {
stats.incrSysExceptions(deathException);
}
+ // clear possible thread interrupted state so that closing can be
handled gracefully
+ Thread.interrupted();
} finally {
log.info("Closing instance");
close();