@@ -201,8 +201,8 @@ public void connect(PipedOutputStream src) throws IOException {
201201 protected synchronized void receive (int b ) throws IOException {
202202 checkStateForReceive ();
203203 writeSide = Thread .currentThread ();
204- if (in == out )
205- awaitSpace ();
204+ // if (in == out)
205+ // awaitSpace();
206206 if (in < 0 ) {
207207 in = 0 ;
208208 out = 0 ;
@@ -228,8 +228,8 @@ synchronized void receive(byte b[], int off, int len) throws IOException {
228228 writeSide = Thread .currentThread ();
229229 int bytesToTransfer = len ;
230230 while (bytesToTransfer > 0 ) {
231- if (in == out )
232- awaitSpace ();
231+ // if (in == out)
232+ // awaitSpace();
233233 int nextTransferAmount = 0 ;
234234 if (out < in ) {
235235 nextTransferAmount = buffer .length - in ;
@@ -264,19 +264,19 @@ private void checkStateForReceive() throws IOException {
264264 }
265265 }
266266
267- private void awaitSpace () throws IOException {
268- while (in == out ) {
269- checkStateForReceive ();
270-
271- /* full: kick any waiting readers */
272- notifyAll ();
273- try {
274- wait (1000 );
275- } catch (InterruptedException ex ) {
276- throw new java .io .InterruptedIOException ();
277- }
278- }
279- }
267+ // private void awaitSpace() throws IOException {
268+ // while (in == out) {
269+ // checkStateForReceive();
270+ //
271+ // /* full: kick any waiting readers */
272+ // notifyAll();
273+ // try {
274+ // wait(1000);
275+ // } catch (InterruptedException ex) {
276+ // throw new java.io.InterruptedIOException();
277+ // }
278+ // }
279+ // }
280280
281281 /**
282282 * Notifies all waiting threads that the last byte of data has been
@@ -313,22 +313,24 @@ public synchronized int read() throws IOException {
313313
314314 readSide = Thread .currentThread ();
315315 int trials = 2 ;
316- while (in < 0 ) {
317- if (closedByWriter ) {
318- /* closed by writer, return EOF */
319- return -1 ;
320- }
321- if ((writeSide != null ) && (!writeSide .isAlive ()) && (--trials < 0 )) {
322- throw new IOException ("Pipe broken" );
323- }
324- /* might be a writer waiting */
325- notifyAll ();
326- try {
327- wait (1000 );
328- } catch (InterruptedException ex ) {
329- throw new java .io .InterruptedIOException ();
330- }
331- }
316+ if (in < 0 )
317+ return -1 ; // SwingJS
318+ // while (in < 0) {
319+ // if (closedByWriter) {
320+ // /* closed by writer, return EOF */
321+ // return -1;
322+ // }
323+ // if ((writeSide != null) && (!writeSide.isAlive()) && (--trials < 0)) {
324+ // throw new IOException("Pipe broken");
325+ // }
326+ // /* might be a writer waiting */
327+ // notifyAll();
328+ // try {
329+ // wait(1000);
330+ // } catch (InterruptedException ex) {
331+ // throw new java.io.InterruptedIOException();
332+ // }
333+ // }
332334 int ret = buffer [out ++] & 0xFF ;
333335 if (out >= buffer .length ) {
334336 out = 0 ;
0 commit comments