Example usage for java.net UnknownHostException fillInStackTrace

List of usage examples for java.net UnknownHostException fillInStackTrace

Introduction

In this page you can find the example usage for java.net UnknownHostException fillInStackTrace.

Prototype

public synchronized Throwable fillInStackTrace() 

Source Link

Document

Fills in the execution stack trace.

Usage

From source file:org.ohie.pocdemo.form.util.ClientRegistryUtil.java

public static Socket connect(final String host, final int port, int nrRetries)
        throws UnknownHostException, IOException {
    final String prop = "100000";
    final int timeout = prop == null ? -1 : Integer.parseInt(prop);

    while (nrRetries-- >= 0) {
        try {/*ww  w.  j ava 2 s  . co m*/
            final Socket rv = new Socket(host, port);
            if (timeout >= 0) {
                rv.setSoTimeout(timeout);
            }

            return rv;
        } catch (final UnknownHostException e) {
            e.fillInStackTrace();
            //Utl.dp("connect failed: unknownHost:", host, port);
            throw e;
        } catch (final IOException e) {
            if (nrRetries < 0) {
                e.fillInStackTrace();
                //Utl.dp("connect failed: connection refused:", host, port);
                throw e;
            }
            // sleep(10);
        }
    }
    throw new HL7IOException("connect nr retries exceeded:" + host + "|" + port + "|" + nrRetries);
}

From source file:org.regenstrief.hl7.util.HL7IO.java

public static Socket connect(final String host, final int port, int nrRetries)
        throws UnknownHostException, IOException {
    final String prop = Util.getProperty(PROP_TIMEOUT_IN_MILLIS);
    final int timeout = prop == null ? -1 : Integer.parseInt(prop);

    while (nrRetries-- >= 0) {
        try {/*w  w w  .j  a va2s .c  om*/
            final Socket rv = new Socket(host, port);
            if (timeout >= 0) {
                rv.setSoTimeout(timeout);
            }

            return rv;
        } catch (final UnknownHostException e) {
            e.fillInStackTrace();
            //Utl.dp("connect failed: unknownHost:", host, port);
            throw e;
        } catch (final IOException e) {
            if (nrRetries < 0) {
                e.fillInStackTrace();
                //Utl.dp("connect failed: connection refused:", host, port);
                throw e;
            }
            sleep(10);
        }
    }
    throw new HL7IOException("connect nr retries exceeded:" + host + "|" + port + "|" + nrRetries);
}