Dear all First sorry to send question off this list. Can anyone explain in following example why just after 3000 milisecond, synchronized(this){} within myfunc() can't regain Lock ? (Compile and try, Actually only after while( i <70) {} completes , synchronized(this){} within myfunc() regains lock!) ------------------------- import java.io.*; public class Wait{ void myfunc() throws IOException,InterruptedIOException,InterruptedException { TimedGetConnection aTimedGetConnection=new TimedGetConnection(this); synchronized(this){ System.err.println( "Now ,aTimedGetConnection.start()" ); aTimedGetConnection.start(); try{ System.err.println( "[myfunc()]Now ,before wait(3000)" ); wait(3000); System.err.println( "[myfunc()]Now ,after wait(3000)" ); }catch(InterruptedException IE){ IE.printStackTrace(); throw IE; } System.err.println( "[TimedGetDataInputStream()]Now ,check Connection!" ); if(!aTimedGetConnection.isGot()){ if(aTimedGetConnection.isError() ) throw aTimedGetConnection.getException(); else throw new InterruptedIOException("Could not get response for " + 3000 + " milliseconds"); } } } public static void main(String[] args){ Wait aa=new Wait(); try{ aa.myfunc(); }catch(Exception e){} } } class TimedGetConnection extends Thread { InputStream aInputStream; Object lock; private IOException m_exception = null; public TimedGetConnection(Object lock){ this.lock=lock; // start(); } public boolean isGot() { if (aInputStream == null) return false; else return true; } public void run(){ synchronized(lock){ try{ System.err.println( "[TimedGetConnection]within run(), now call getInputStream()" ); int i=0; while( i <70){ sleep(100); i++; System.err.println( "[TimedGetConnection]within run(), i=>"+i ); } throw new Exception("TestError"); }catch ( Exception ioe ) { return; } } } public boolean isError(){ if(m_exception==null) return false; else return true; } public IOException getException() { return m_exception; } } ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html