After looking closer at the patch I notice a couple of issues:
1. Does it make sense to set the thread as a daemon? I don't think
frameworks are required to have non-daemon threads...we would have
to think about it.
2. Bundles are not supposed to call stop on themselves, so we would
have to change that...we don't really need to stop the bundle, we
can just have it stop processing input.
Thoughts?
-> richard
Nektarios K. Papadopoulos wrote:
...or ShellTUI can treat problems reading from stdin as fatal and stop
itself. The attached patch demonstrates what I mean.
--
nek
Richard S. Hall wrote:
Just don't load the ShellTUI bundle, which is responsible for
printing "-> " on its own thread. In production mode you don't need
this bundle at all. You can still install the shell bundle, but
install it with telnetd or something similar so you can have remote
shell access. ShellTUI is only for interactive console execution of
the framework.
-> richard
Alex Karasulu wrote:
Looks like the standard out log file fills up with ...
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> -
> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> -
> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> -
> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> -
> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
-> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
-> -> -> ->
It keeps on filling and filling ... it will fill a disk if you let
it. How can we disable
this shell in production mode?
Alex
------------------------------------------------------------------------
Index:
org.apache.felix.shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
===================================================================
---
org.apache.felix.shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
(revision 384538)
+++
org.apache.felix.shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
(working copy)
@@ -25,6 +25,7 @@
{
private transient BundleContext m_context = null;
private transient ShellTuiRunnable m_runnable = null;
+ private transient Thread m_thread = null;
private transient ServiceReference m_shellRef = null;
private transient ShellService m_shell = null;
@@ -78,9 +79,11 @@
initializeService();
// Start impl thread.
- new Thread(
+ m_thread = new Thread(
m_runnable = new ShellTuiRunnable(),
- "Felix Shell TUI").start();
+ "Felix Shell TUI");
+ m_thread.setDaemon(true);
+ m_thread.start();
}
private synchronized void initializeService()
@@ -121,6 +124,14 @@
System.out.print("-> ");
try {
+ while (!in.ready()) {
+ synchronized(in) {
+ try {
+ in.wait(100);
+ } catch(InterruptedException ie) {
+ }
+ }
+ }
line = in.readLine();
} catch (IOException ex) {
System.err.println("Could not read input, please try
again.");
@@ -132,11 +143,21 @@
if (m_shell == null)
{
System.out.println("No impl service available.");
+ try {
+ m_context.getBundle().stop();
+ } catch (BundleException bce) {
+ stop =true;
+ }
continue;
}
if (line == null)
{
+ try {
+ m_context.getBundle().stop();
+ } catch (BundleException bce) {
+ stop =true;
+ }
continue;
}