langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java
changeset 41518 8fd0057d88f3
parent 38909 80e42e2d475b
child 42827 36468b5fa7f4
equal deleted inserted replaced
41517:ae82072ecfa7 41518:8fd0057d88f3
    75                         }
    75                         }
    76                     }
    76                     }
    77                 } catch (IOException ex) {
    77                 } catch (IOException ex) {
    78                     errorHandler.accept(ex);
    78                     errorHandler.accept(ex);
    79                 } finally {
    79                 } finally {
    80                     synchronized (StopDetectingInputStream.this) {
    80                     shutdown();
    81                         state = StopDetectingInputStream.State.CLOSED;
       
    82                     }
       
    83                 }
    81                 }
    84             }
    82             }
    85         };
    83         };
    86         reader.setDaemon(true);
    84         reader.setDaemon(true);
    87         reader.start();
    85         reader.start();
   138         end = newEnd;
   136         end = newEnd;
   139         notifyAll();
   137         notifyAll();
   140     }
   138     }
   141 
   139 
   142     public synchronized void setState(State state) {
   140     public synchronized void setState(State state) {
   143         this.state = state;
   141         if (this.state != State.CLOSED) {
   144         notifyAll();
   142             this.state = state;
       
   143             notifyAll();
       
   144         }
   145     }
   145     }
   146 
   146 
   147     private synchronized State waitInputNeeded() {
   147     private synchronized State waitInputNeeded() {
   148         while (state == State.WAIT) {
   148         while (state == State.WAIT) {
   149             try {
   149             try {