Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected class ExecuteTimeoutThread extends Thread
- {
- /** Method that is executing. */
- protected HttpUriRequest request;
- /** Timeout in seconds. */
- protected int timeout;
- /**
- * <p>Construct a timeout thread with a specific
- * method instance.
- *
- * @param request HTTP request to call abort on.
- * @param timeout Timeout value to check.
- */
- public ExecuteTimeoutThread(
- HttpUriRequest request,
- int timeout
- )
- {
- super();
- this.request = request;
- this.timeout = timeout;
- }
- /**
- * <p>Run the thread. Call {@link #interrupt()} when you want this
- * thread to exit.
- */
- public void run()
- {
- try
- {
- sleep( timeout * 1000L );
- request.abort();
- }
- catch (InterruptedException interruptedException)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment