类javax.naming.InterruptedNamingException源码实例Demo

下面列出了怎么用javax.naming.InterruptedNamingException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException {
    BerDecoder rber;

    try {
        // if no timeout is set so we wait infinitely until
        // a response is received
        // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
        rber = ldr.getReplyBer(readTimeout);
    } catch (InterruptedException ex) {
        throw new InterruptedNamingException(
            "Interrupted during LDAP operation");
    }

    if (rber == null) {
        abandonRequest(ldr, null);
        throw new NamingException(
                "LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码2 项目: TencentKona-8   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException {
    BerDecoder rber;

    try {
        // if no timeout is set so we wait infinitely until
        // a response is received
        // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
        rber = ldr.getReplyBer(readTimeout);
    } catch (InterruptedException ex) {
        throw new InterruptedNamingException(
            "Interrupted during LDAP operation");
    }

    if (rber == null) {
        abandonRequest(ldr, null);
        throw new NamingException(
                "LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码3 项目: openjdk-jdk8u   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException {
    BerDecoder rber;

    try {
        // if no timeout is set so we wait infinitely until
        // a response is received
        // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
        rber = ldr.getReplyBer(readTimeout);
    } catch (InterruptedException ex) {
        throw new InterruptedNamingException(
            "Interrupted during LDAP operation");
    }

    if (rber == null) {
        abandonRequest(ldr, null);
        throw new NamingException(
                "LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码4 项目: jdk8u_jdk   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr) throws IOException, NamingException {
    BerDecoder rber;

    try {
        // if no timeout is set so we wait infinitely until
        // a response is received
        // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
        rber = ldr.getReplyBer(readTimeout);
    } catch (InterruptedException ex) {
        throw new InterruptedNamingException(
            "Interrupted during LDAP operation");
    }

    if (rber == null) {
        abandonRequest(ldr, null);
        throw new NamingException(
                "LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码5 项目: dragonwell8_jdk   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码6 项目: TencentKona-8   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码7 项目: jdk8u60   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码8 项目: openjdk-jdk8u   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码10 项目: openjdk-jdk9   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码11 项目: jdk8u-jdk   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码12 项目: hottub   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码13 项目: openjdk-8-source   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码14 项目: openjdk-8   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码15 项目: jdk8u_jdk   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码16 项目: jdk8u-jdk   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码17 项目: jdk8u-dev-jdk   文件: Connections.java
/**
 * Retrieves a PooledConnection from this list of connections.
 * Use an existing one if one is idle, or create one if the list's
 * max size hasn't been reached. If max size has been reached, wait
 * for a PooledConnection to be returned, or one to be removed (thus
 * not reaching the max size any longer).
 *
 * @param timeout if > 0, msec to wait until connection is available
 * @param factory creates the PooledConnection if one needs to be created
 *
 * @return A non-null PooledConnection
 * @throws NamingException PooledConnection cannot be created, because this
 * thread was interrupted while it waited for an available connection,
 * or if it timed out while waiting, or the creation of a connection
 * resulted in an error.
 */
synchronized PooledConnection get(long timeout,
    PooledConnectionFactory factory) throws NamingException {
    PooledConnection conn;
    long start = (timeout > 0 ? System.currentTimeMillis() : 0);
    long waittime = timeout;

    d("get(): before");
    while ((conn = getOrCreateConnection(factory)) == null) {
        if (timeout > 0 && waittime <= 0) {
            throw new CommunicationException(
                "Timeout exceeded while waiting for a connection: " +
                timeout + "ms");
        }
        try {
            d("get(): waiting");
            if (waittime > 0) {
                wait(waittime);  // Wait until one is released or removed
            } else {
                wait();
            }
        } catch (InterruptedException e) {
            throw new InterruptedNamingException(
                "Interrupted while waiting for a connection");
        }
        // Check whether we timed out
        if (timeout > 0) {
            long now = System.currentTimeMillis();
            waittime = timeout - (now - start);
        }
    }

    d("get(): after");
    return conn;
}
 
源代码18 项目: openjdk-8-source   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        ldr.wait(15 * 1000); // 15 second timeout
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        removeRequest(ldr);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码19 项目: openjdk-8   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        ldr.wait(15 * 1000); // 15 second timeout
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        removeRequest(ldr);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码20 项目: jdk8u-jdk   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        // no timeout is set so we wait infinitely until
                        // a response is received
                        // https://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
                        ldr.wait();
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        abandonRequest(ldr, null);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
源代码21 项目: jdk8u-dev-jdk   文件: Connection.java
/**
 * Reads a reply; waits until one is ready.
 */
BerDecoder readReply(LdapRequest ldr)
        throws IOException, NamingException {
    BerDecoder rber;
    boolean waited = false;

    while (((rber = ldr.getReplyBer()) == null) && !waited) {
        try {
            // If socket closed, don't even try
            synchronized (this) {
                if (sock == null) {
                    throw new ServiceUnavailableException(host + ":" + port +
                        "; socket closed");
                }
            }
            synchronized (ldr) {
                // check if condition has changed since our last check
                rber = ldr.getReplyBer();
                if (rber == null) {
                    if (readTimeout > 0) {  // Socket read timeout is specified

                        // will be woken up before readTimeout only if reply is
                        // available
                        ldr.wait(readTimeout);
                        waited = true;
                    } else {
                        // no timeout is set so we wait infinitely until
                        // a response is received
                        // https://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
                        ldr.wait();
                    }
                } else {
                    break;
                }
            }
        } catch (InterruptedException ex) {
            throw new InterruptedNamingException(
                "Interrupted during LDAP operation");
        }
    }

    if ((rber == null) && waited) {
        abandonRequest(ldr, null);
        throw new NamingException("LDAP response read timed out, timeout used:"
                        + readTimeout + "ms." );

    }
    return rber;
}
 
 类所在包
 类方法
 同包方法