Forums Register Login

How to block the execution of Thread

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
The Thread.sleep(millis) method is the way to prevent a thread from doing anything for a certain period of time.
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
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.
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 716 times.
Similar Threads
Is this JWhiz thread question wrong?
main(), PrintWriter and Collection
main(),printwriter and collections
synchronized
Java threads
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:18:09.