From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12154 invoked by alias); 19 Sep 2003 20:41:58 -0000 Mailing-List: contact mauve-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sources.redhat.com Received: (qmail 12147 invoked from network); 19 Sep 2003 20:41:56 -0000 Received: from unknown (HELO merc65.na.sas.com) (149.173.6.60) by sources.redhat.com with SMTP; 19 Sep 2003 20:41:56 -0000 Received: from merc18.na.sas.com ([10.16.12.224]) by 10.19.11.13 with InterScan Messaging Security Suite; Fri, 19 Sep 2003 16:41:56 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.0.6410.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Question about Thread.sleep(1000) in java.io.PipedStream close.java code Date: Fri, 19 Sep 2003 20:41:00 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Patrick Ellis" To: X-SW-Source: 2003-q3/txt/msg00013.txt.bz2 I have a question about the Thread.sleep(1000) command in the close.java co= de. The delay does not seem long enough On an R64 machine that I'm testing. When I change the code to Thread.sleep(= 100) the code seems to delay long enough for execute the code.=20 Is this correct ?=20 1 // Tags: JDK1.0 2 3 // This test is from Jeff Sturm. 4 // It tests whether close() on a PipedInputStream will correctly 5 // notify the writer. 6 7 package gnu.testlet.java.io.PipedStream; 8 9 import gnu.testlet.Testlet; 10 import gnu.testlet.TestHarness; 11 import java.io.*; 12 13 public class close implements Runnable, Testlet { 14 Thread main; 15 PipedInputStream in; 16 PipedOutputStream out; 17 TestHarness harness; 18 19 public void run() { 20 try { 21 Thread.sleep(1000); 22 harness.debug("Closing pipe input stream:"); 23 in.close(); 24 Thread.sleep(1000); 25 harness.debug("Interrupting pipe reader:"); 26 main.interrupt(); 27 } catch (Throwable t) { 28 harness.debug(t); 29 } 30 } 31 32 public void test (TestHarness harness) { 33 int val =3D 23; 34 try { 35 close test =3D new close(); 36 test.harness =3D harness; 37 38 test.main =3D Thread.currentThread(); 39 test.out =3D new PipedOutputStream(); 40 test.in =3D new PipedInputStream(test.out); 41 42 (new Thread(test)).start(); 43 44 val =3D test.in.read(); 45 } catch (InterruptedIOException t) { 46 harness.check(true,"read() interrupted okay= "); 47 } catch (IOException t) { 48 harness.fail("Unexpected IOException thrown= "); 49 } 50 } 51 } Pat Ellis SAS Tools, Testing & Validation Phone: (919) 531-0355=20=20=20 R2263 Patrick.Ellis@sas.com SAS... The Power to Know