You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2009/09/06 21:09:57 UTC

svn commit: r811863 - /felix/trunk/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java

Author: rickhall
Date: Sun Sep  6 19:09:57 2009
New Revision: 811863

URL: http://svn.apache.org/viewvc?rev=811863&view=rev
Log:
Add configuration property to control whether we check for available
input or not. (FELIX-619)

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=811863&r1=811862&r2=811863&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 Sun Sep  6 19:09:57 2009
@@ -25,16 +25,23 @@
 
 public class Activator implements BundleActivator
 {
+    private static final String CHECK_INPUT_PROP = "shell.tui.checkinput";
+
     private BundleContext m_context = null;
     private volatile ShellTuiRunnable m_runnable = null;
     private volatile Thread m_thread = null;
     private ServiceReference m_shellRef = null;
     private ShellService m_shell = null;
+    private volatile boolean m_checkInput = false;
 
     public void start(BundleContext context)
     {
         m_context = context;
 
+        // Check for configuration property.
+        String s = context.getProperty(CHECK_INPUT_PROP);
+        m_checkInput = (s == null) ? false : Boolean.valueOf(s).booleanValue();
+
         // Listen for registering/unregistering impl service.
         ServiceListener sl = new ServiceListener() {
             public void serviceChanged(ServiceEvent event)
@@ -131,20 +138,23 @@
                         needPrompt = false;
                     }
 
-                    available = System.in.available();
-
-                    if (available == 0)
+                    if (m_checkInput)
                     {
-                        try
-                        {
-                            Thread.sleep(200);
-                        }
-                        catch (InterruptedException ex)
+                        available = System.in.available();
+
+                        if (available == 0)
                         {
-                            // No one should be interrupting this thread, so
-                            // ignore it.
+                            try
+                            {
+                                Thread.sleep(200);
+                            }
+                            catch (InterruptedException ex)
+                            {
+                                // No one should be interrupting this thread, so
+                                // ignore it.
+                            }
+                            continue;
                         }
-                        continue;
                     }
 
                     line = in.readLine();