This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.4.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.4.x by this push:
     new 04a9654087 KARAF-7691 Prevent exception on status check by terminating 
ShutdownSocketThread loop before socket closes
04a9654087 is described below

commit 04a9654087d5253e0ab5f5853f1440f1f4315ccd
Author: Ian Thiemann <ian.thiem...@kisters.de>
AuthorDate: Tue Mar 19 08:43:08 2024 +0100

    KARAF-7691 Prevent exception on status check by terminating 
ShutdownSocketThread loop before socket closes
    
    (cherry picked from commit c7bdb9eea312a8ab4027846dbd57b0ec78f5e690)
---
 main/src/main/java/org/apache/karaf/main/Status.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/main/src/main/java/org/apache/karaf/main/Status.java 
b/main/src/main/java/org/apache/karaf/main/Status.java
index 58d02f1ae2..f7bf36e5f7 100644
--- a/main/src/main/java/org/apache/karaf/main/Status.java
+++ b/main/src/main/java/org/apache/karaf/main/Status.java
@@ -58,6 +58,8 @@ public class Status {
             try (Socket s = new Socket(config.shutdownHost, 
config.shutdownPort)) {
                 if (s.isBound()) {
                     System.out.println(RUNNING);
+                    //Send control character EOT to break ShutdownSocketThread 
loop before socket closes
+                    s.getOutputStream().write(04);
                     System.exit(0);
                 } else {
                     System.out.println(NOT_RUNNING);

Reply via email to