Hey,

Try to use wait(milisec) rather then sleep().

Reason is sleep causes the locking of entire synchronized methods. And
this lock won't be released until sleep gets over.
But wait does not result in locking of your synch. method. Hence other
threads can access ur object's other synch. methods.

Vikas...

-----Original Message-----
From: Steven [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 9:27 AM
To: JDJList
Subject: [jdjlist] Thread.sleep problem...Please help


Hi All,

I am doing a Java application right now. In this application, some
actions
need to be taken only after few seconds. I thought Thread.sleep is the
good
way to do it but while the program is sleeping, my com port listener
will be
unable to perform any action.
So may I know what is the best way to make the action few seconds later
but
the com port listener still listening the coming event?
Hope can help. Thank you.





Steven


To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm


--------------------------------------------------------------
Minerva Telelink Private Limited, New Delhi, India
   Sent using "PostMaster" by QuantumLink Communications
 One Internet account, unlimited personal e-mail addresses
Get your free copy of "PostMaster" at http://www.mailserve.net/



--------------------------------------------------------------
Minerva Telelink Private Limited, New Delhi, India
   Sent using "PostMaster" by QuantumLink Communications
 One Internet account, unlimited personal e-mail addresses
Get your free copy of "PostMaster" at http://www.mailserve.net/



To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to