From owner-freebsd-java Tue May 30 13: 6:44 2000 Delivered-To: freebsd-java@freebsd.org Received: from smtp.pandora.be (hercules.telenet-ops.be [195.130.132.33]) by hub.freebsd.org (Postfix) with SMTP id 6D56637B75C for ; Tue, 30 May 2000 13:06:34 -0700 (PDT) (envelope-from christophe.colle@telenet.be) Received: (qmail 29780 invoked from network); 30 May 2000 20:06:31 -0000 Received: from unknown (HELO zeus.telenet-ops.be) ([195.130.132.40]) (envelope-sender ) by hercules.telenet-ops.be (qmail-ldap-1.03) with SMTP for ; 30 May 2000 20:06:31 -0000 Date: Tue, 30 May 2000 22:06:31 +0200 (MET DST) From: Christophe Colle X-Sender: colle@zeus To: freebsd-java@freebsd.org Subject: java_X version "1.1.8" stuck on BufferedReader.readLine Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, I have a problem with jdk 1.1.8 on FreeBSD.. Apparently when doing a readLine on a BufferedReader-object all my threads hang :-( Consider the follwing part of java-code: import java.lang.*; import java.io.*; class Clock extends Thread { private Thread master; private long timeout; protected void sleepFor(long timeout) { master=Thread.currentThread(); this.timeout=timeout; this.start(); } protected void clear() { this.interrupt(); this.stop(); } public void run() { System.out.println("you should see mee running, but in jdk1.1.8 you don't see me :-("); try { this.sleep(timeout); //you should see the following message, but you won't with jdb1.1.8 and freebsd System.out.println("timed out... interrupting master thread"); master.interrupt(); } catch (InterruptedException e) { System.out.println("I got terminated"); return; } catch (Exception e) { e.printStackTrace(); } } } public class test { void loop() { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); while (true) { String str=""; boolean timedout=false; Clock alarm=new Clock(); try { alarm.sleepFor(1000); str=in.readLine(); alarm.clear(); } catch (IOException e) { if (Thread.interrupted()) { timedout=true; System.out.println("interrupt ...."); } else { e.printStackTrace(); System.exit(99); } } if (timedout == false && str == null) System.exit(0); System.out.println("--- "+str); } } static public void main(String args[]) { new test().loop(); } } When I run this on a solaris machine I see the following output (paced every second): colle@olympus: java test you should see mee running, but in jdk1.1.8 you don't see me :-( timed out... interrupting master thread interrupt .... --- you should see mee running, but in jdk1.1.8 you don't see me :-( timed out... interrupting master thread interrupt .... --- you should see mee running, but in jdk1.1.8 you don't see me :-( timed out... interrupting master thread interrupt .... --- When doing the same on a FreeBSD machine: bash-2.03$ java -version java_X version "1.1.8" bash-2.03$ bash-2.03$ bash-2.03$ java test ^Cbash-2.03$ nothing ... it gets stuck :-( ^Cbash-2.03$ uname -a FreeBSD portable.is.cool 3.4-RELEASE FreeBSD 3.4-RELEASE #2: Sun Feb 621:39:44 CET 2000 root@portable.is.cool:/old/src-cvs/src/sys/compile/PORTABLE i386 What can I do to get this problem solved? Thanks! cc --- you type win, but you lose The Internet doesn't really need admins that are dumber than the ones we have already. ---- Christophe Colle Telenet, Liersesteenweg 4, 2800 Mechelen, Belgium tel:+32(0)15.333.981 mailto:christophe.colle@telenet.be http://krtkg1.rug.ac.be/~colle To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message