Example usage for java.net SocketTimeoutException printStackTrace

List of usage examples for java.net SocketTimeoutException printStackTrace

Introduction

In this page you can find the example usage for java.net SocketTimeoutException printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:org.talend.core.nexus.HttpClientTransport.java

public void doRequest(IProgressMonitor monitor, final URI requestURI) throws Exception {
    int retries = 5;
    long waitMillis = 20000;

    int timeout = NexusServerUtils.getTimeout();
    boolean fTimeout = false;

    for (int t = 1; t <= retries; t++) {
        try {//from  w ww.  j a va 2 s.c  o m
            fTimeout = false;
            doRequestOne(monitor, requestURI);
        } catch (java.net.SocketTimeoutException e) {
            // Read timed out
            fTimeout = true;
            if (t == retries) {
                throw new Exception(e);
            }
        } catch (Exception e) {
            // DEBUG //
            System.err.printf("[%d] Exception occured for %s\n", t, requestURI);
            e.printStackTrace(System.err);
            // DEBUG //
            throw e;
        }
        if (!fTimeout) {
            break;
        }
        // DEBUG //
        System.err.printf("[%d] Read timeout (in %d millisecs) occured for %s\n", t, timeout, requestURI);
        // DEBUG //

        Thread.sleep(waitMillis * t);
    }
}