karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject [1/4] git commit: KARAF-3021 - Keyboard still read after log:tail cancelled
Date Wed, 04 Jun 2014 19:10:19 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-2.3.x 00e4d3433 -> 728cd0ee7
  refs/heads/karaf-2.x f3a6a72cf -> 530924560
  refs/heads/karaf-3.0.x b9cecabf4 -> 8c60f0e6a
  refs/heads/master 5532278ab -> 8a3090b5c


KARAF-3021 - Keyboard still read after log:tail cancelled


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/53092456
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/53092456
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/53092456

Branch: refs/heads/karaf-2.x
Commit: 530924560890e70f87f86e4eb5bc786f5a608c63
Parents: f3a6a72
Author: Jonathan Anstey <janstey@gmail.com>
Authored: Wed Jun 4 16:23:42 2014 -0230
Committer: Jonathan Anstey <janstey@gmail.com>
Committed: Wed Jun 4 16:28:14 2014 -0230

----------------------------------------------------------------------
 .../main/java/org/apache/karaf/shell/log/LogTail.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/53092456/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
----------------------------------------------------------------------
diff --git a/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java b/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
index 1f25ecd..173b0bd 100644
--- a/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
+++ b/shell/log/src/main/java/org/apache/karaf/shell/log/LogTail.java
@@ -36,8 +36,10 @@ public class LogTail extends DisplayLog {
 
     protected Object doExecute() throws Exception {
         PrintEventThread printThread = new PrintEventThread();
+        ReadKeyBoardThread readKeyboardThread = new ReadKeyBoardThread(this, Thread.currentThread());
         executorService.execute(printThread);
-        new Thread(new ReadKeyBoardThread(this, Thread.currentThread())).start();
+        executorService.execute(readKeyboardThread);
+        
         while (!Thread.currentThread().isInterrupted()) {
             try {
                 Thread.sleep(200);
@@ -46,6 +48,7 @@ public class LogTail extends DisplayLog {
             }
         }
         printThread.abort();
+        readKeyboardThread.abort();
         executorService.shutdownNow();  
         return null;
     }
@@ -53,12 +56,19 @@ public class LogTail extends DisplayLog {
     class ReadKeyBoardThread implements Runnable {
         private LogTail logTail;
         private Thread sessionThread;
+        boolean readKeyboard = true;
+        
         public ReadKeyBoardThread(LogTail logtail, Thread thread) {
             this.logTail = logtail;
             this.sessionThread = thread;
         }
+        
+        public void abort() {
+            readKeyboard = false;            
+        }
+        
         public void run() {
-            for (;;) {
+            while (readKeyboard) {
                 try {
                     int c = this.logTail.session.getKeyboard().read();
                     if (c < 0) {


Mime
View raw message