public void run()

in src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java [487:548]


    public void run() {
        int ch;

        try {
            _outerLoop: while (!isClosed) {
                try {
                    if ((ch = read(true)) < 0) {
                        break;
                    }
                } catch (final InterruptedIOException e) {
                    synchronized (queue) {
                        ioException = e;
                        queue.notifyAll();
                        try {
                            queue.wait(100);
                        } catch (final InterruptedException interrupted) {
                            if (isClosed) {
                                break _outerLoop;
                            }
                        }
                        continue;
                    }
                } catch (final RuntimeException re) {
                    // We treat any runtime exceptions as though the
                    // stream has been closed. We close the
                    // underlying stream just to be sure.
                    super.close();
                    // Breaking the loop has the effect of setting
                    // the state to closed at the end of the method.
                    break _outerLoop;
                }

                // Process new character
                boolean notify = false;
                try {
                    notify = processChar(ch);
                } catch (final InterruptedException e) {
                    if (isClosed) {
                        break _outerLoop;
                    }
                }

                // Notify input listener if buffer was previously empty
                if (notify) {
                    client.notifyInputListener();
                }
            }
        } catch (final IOException ioe) {
            synchronized (queue) {
                ioException = ioe;
            }
            client.notifyInputListener();
        }

        synchronized (queue) {
            isClosed = true; // Possibly redundant
            hasReachedEOF = true;
            queue.notify();
        }

        threaded = false;
    }