This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Java in General and the fly likes handling timeouts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "handling timeouts" Watch "handling timeouts" New topic

handling timeouts

Ansari Raffik

Joined: Feb 05, 2007
Posts: 7
Can anyone suggest me how a java client invoking a https service handle time-outs?..
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
I suppose it depends on the Http client that you choose.

The Jakarta Commons HttpClient has a TimeoutController class that allows you to execute either a Runnable or Thread object with a specified timeout. It throws a TimeoutController.TimeoutException.

What you do to handle such an exception depends entirely on the application requirements. You could retry the task immediately, log the event and exit, rotate the task to the end of the queue, or any other scheme that you choose.

Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
I agree. Here's the link:
subject: handling timeouts
It's not a secret anymore!