Author: pauls
Date: Mon Apr 21 12:55:56 2008
New Revision: 650237
URL: http://svn.apache.org/viewvc?rev=650237&view=rev
Log:
Revert the changes to shell tui that make it stoppable without user input from
system.in - The solution is working fine on *x but doesn't on windows.
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=650237&r1=650236&r2=650237&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
Mon Apr 21 12:55:56 2008
@@ -83,13 +83,10 @@
// since one might already be available.
initializeService();
- synchronized (this)
- {
- // Start impl thread.
- m_thread = new Thread(
- m_runnable = new ShellTuiRunnable(),
- "Felix Shell TUI");
- }
+ // Start impl thread.
+ m_thread = new Thread(
+ m_runnable = new ShellTuiRunnable(),
+ "Felix Shell TUI");
m_thread.start();
}
@@ -110,19 +107,16 @@
public void stop(BundleContext context)
{
- synchronized (this)
+ if (m_runnable != null)
{
- if (m_runnable != null)
- {
- m_runnable.stop();
- m_thread.interrupt();
- }
+ m_runnable.stop();
+ m_thread.interrupt();
}
}
private class ShellTuiRunnable implements Runnable
{
- private volatile boolean stop = false;
+ private boolean stop = false;
public void stop()
{
@@ -133,22 +127,15 @@
{
String line = null;
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
+
while (!stop)
{
System.out.print("-> ");
try
{
- while (!in.ready())
- {
- Thread.sleep(20);
- }
line = in.readLine();
}
- catch (InterruptedException ex)
- {
- continue;
- }
catch (IOException ex)
{
System.err.println("Could not read input, please try
again.");
@@ -188,4 +175,4 @@
}
}
}
-}
+}
\ No newline at end of file