Author: rickhall
Date: Tue Sep 23 07:03:15 2008
New Revision: 698182

URL: http://svn.apache.org/viewvc?rev=698182&view=rev
Log:
Modified the input thread to look for null input lines, in which case it 
assumes that there is no standard input and exits. If we do not do this,
then the thread will enter a tight infinite loop. (FELIX-729)

Modified:
    
felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java

Modified: 
felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java?rev=698182&r1=698181&r2=698182&view=diff
==============================================================================
--- 
felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java 
(original)
+++ 
felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java 
Tue Sep 23 07:03:15 2008
@@ -26,8 +26,8 @@
 public class Activator implements BundleActivator
 {
     private BundleContext m_context = null;
-    private ShellTuiRunnable m_runnable = null;
-    private Thread m_thread = null;
+    private volatile ShellTuiRunnable m_runnable = null;
+    private volatile Thread m_thread = null;
     private ServiceReference m_shellRef = null;
     private ShellService m_shell = null;
 
@@ -116,7 +116,7 @@
 
     private class ShellTuiRunnable implements Runnable
     {
-        private boolean stop = false;
+        private volatile boolean stop = false;
 
         public void stop()
         {
@@ -144,14 +144,15 @@
 
                 synchronized (Activator.this)
                 {
-                    if (m_shell == null)
+                    if (line == null)
                     {
-                        System.out.println("No impl service available.");
-                        continue;
+                        System.err.println("ShellTUI: No standard 
input...exiting.");
+                        break;
                     }
 
-                    if (line == null)
+                    if (m_shell == null)
                     {
+                        System.out.println("No impl service available.");
                         continue;
                     }
 
@@ -168,7 +169,7 @@
                     }
                     catch (Exception ex)
                     {
-                        System.err.println("ShellTui: " + ex);
+                        System.err.println("ShellTUI: " + ex);
                         ex.printStackTrace();
                     }
                 }


Reply via email to