• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to block the execution of Thread  RSS feed

 
ajay mittal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have created an application that has only main thread, this main thread calls the api of another application. Sometimes another application goes down this results in java.net.ConnectException. Due to which my application skips the entry and checks for another entry and call the api of another application for next entry. I want to block the execution of my application till another application becomes up.

Please tell me how can i achieve this.

Ajay Mittal.
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Thread.sleep(millis) method is the way to prevent a thread from doing anything for a certain period of time.
 
ajay mittal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:The Thread.sleep(millis) method is the way to prevent a thread from doing anything for a certain period of time.



yes, i know this guys, but in this case i donot know that for how much time do i need to sleep. Is there any means to know when that when another application will get up.

Ajay Mittal
 
Pavan Kumar Dittakavi
Ranch Hand
Posts: 108
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, but is thread.sleep really advisable? Sleep mechanism is not at all advised in the software we are developing. So, is there any means of accomplishing the same without sleep call?


-Pavan.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!