src/share/classes/com/sun/jndi/ldap/Connection.java

Print this page




 442         boolean waited = false;
 443 
 444         while (((rber = ldr.getReplyBer()) == null) && !waited) {
 445             try {
 446                 // If socket closed, don't even try
 447                 synchronized (this) {
 448                     if (sock == null) {
 449                         throw new ServiceUnavailableException(host + ":" + port +
 450                             "; socket closed");
 451                     }
 452                 }
 453                 synchronized (ldr) {
 454                     // check if condition has changed since our last check
 455                     rber = ldr.getReplyBer();
 456                     if (rber == null) {
 457                         if (readTimeout > 0) {  // Socket read timeout is specified
 458 
 459                             // will be woken up before readTimeout only if reply is
 460                             // available
 461                             ldr.wait(readTimeout);
 462                             waited = true;
 463                         } else {
 464                             ldr.wait(15 * 1000); // 15 second timeout
 465                         }

 466                     } else {
 467                         break;
 468                     }
 469                 }
 470             } catch (InterruptedException ex) {
 471                 throw new InterruptedNamingException(
 472                     "Interrupted during LDAP operation");
 473             }
 474         }
 475 
 476         if ((rber == null) && waited) {
 477             removeRequest(ldr);
 478             throw new NamingException("LDAP response read timed out, timeout used:"
 479                             + readTimeout + "ms." );
 480 
 481         }
 482         return rber;
 483     }
 484 
 485 




 442         boolean waited = false;
 443 
 444         while (((rber = ldr.getReplyBer()) == null) && !waited) {
 445             try {
 446                 // If socket closed, don't even try
 447                 synchronized (this) {
 448                     if (sock == null) {
 449                         throw new ServiceUnavailableException(host + ":" + port +
 450                             "; socket closed");
 451                     }
 452                 }
 453                 synchronized (ldr) {
 454                     // check if condition has changed since our last check
 455                     rber = ldr.getReplyBer();
 456                     if (rber == null) {
 457                         if (readTimeout > 0) {  // Socket read timeout is specified
 458 
 459                             // will be woken up before readTimeout only if reply is
 460                             // available
 461                             ldr.wait(readTimeout);

 462                         } else {
 463                             ldr.wait(15 * 1000); // 15 second timeout
 464                         }
 465                         waited = true;
 466                     } else {
 467                         break;
 468                     }
 469                 }
 470             } catch (InterruptedException ex) {
 471                 throw new InterruptedNamingException(
 472                     "Interrupted during LDAP operation");
 473             }
 474         }
 475 
 476         if ((rber == null) && waited) {
 477             removeRequest(ldr);
 478             throw new NamingException("LDAP response read timed out, timeout used:"
 479                             + readTimeout + "ms." );
 480 
 481         }
 482         return rber;
 483     }
 484 
 485