• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Timer in Thread

 
RickVorster
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a multithreaded listener program whose purpose is to receive ASN.1 messages. If a new socket connection is received I spwan a new thread. Now part of the incoming message is a timeout value. This is where the problem comes in. With this timeout value I need to start a specified "Job". If this "Job" does not complete in the set time, an exception must be thrown so that I can take alternative action.
I fiddled with the Timer class but to no avail. Any help would be appreciated.
TIA
 
Robert Ziel
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
subscribe to the techtips.
this week's tip is about this topic and you will find your answer there.
Techtip Timer
Robert
[ May 22, 2002: Message edited by: Robert Ziel ]
 
netharam ram
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too have been fiddling with the same problem ,if u could find any reply that will be helpful for me.And do u know how to make a thread sleep for some seconds for eg.30.I tried using
Thread.sleep(1800);
but it waits only for 2 seconds what is the actual problem?Waiting for some reply.
Happy middling with java.
Netharam.
 
Robert Ziel
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
sleep(1800) is 1.8 second
sleep(30000) 30 seconds
or could be a bit more see the api
Robert
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!