721 String hostAddress = localAddr.getHostAddress();
722 FQDN f = new FQDN(hostAddress);
723
724 int nameServiceTimeOut =
725 TCPEndpoint.getInt("sun.rmi.transport.tcp.localHostNameTimeOut",
726 10000);
727
728 try {
729 synchronized(f) {
730 f.getFQDN();
731
732 /* wait to obtain an FQDN */
733 f.wait(nameServiceTimeOut);
734 }
735 } catch (InterruptedException e) {
736 /* propagate the exception to the caller */
737 Thread.currentThread().interrupt();
738 }
739 hostName = f.getHost();
740
741 if ((hostName == null) || (hostName.equals(""))
742 || (hostName.indexOf('.') < 0 )) {
743
744 hostName = hostAddress;
745 }
746 }
747 return hostName;
748 }
749
750 /**
751 * Method that that will start a thread to wait to retrieve a
752 * fully qualified domain name from a name service. The spawned
753 * thread may never return but we have marked it as a daemon so the vm
754 * will terminate appropriately.
755 */
756 private void getFQDN() {
757
758 /* FQDN finder will run in RMI threadgroup. */
759 Thread t = AccessController.doPrivileged(
760 new NewThreadAction(FQDN.this, "FQDN Finder", true));
761 t.start();
|
721 String hostAddress = localAddr.getHostAddress();
722 FQDN f = new FQDN(hostAddress);
723
724 int nameServiceTimeOut =
725 TCPEndpoint.getInt("sun.rmi.transport.tcp.localHostNameTimeOut",
726 10000);
727
728 try {
729 synchronized(f) {
730 f.getFQDN();
731
732 /* wait to obtain an FQDN */
733 f.wait(nameServiceTimeOut);
734 }
735 } catch (InterruptedException e) {
736 /* propagate the exception to the caller */
737 Thread.currentThread().interrupt();
738 }
739 hostName = f.getHost();
740
741 if ((hostName == null) || (hostName.isEmpty())
742 || (hostName.indexOf('.') < 0 )) {
743
744 hostName = hostAddress;
745 }
746 }
747 return hostName;
748 }
749
750 /**
751 * Method that that will start a thread to wait to retrieve a
752 * fully qualified domain name from a name service. The spawned
753 * thread may never return but we have marked it as a daemon so the vm
754 * will terminate appropriately.
755 */
756 private void getFQDN() {
757
758 /* FQDN finder will run in RMI threadgroup. */
759 Thread t = AccessController.doPrivileged(
760 new NewThreadAction(FQDN.this, "FQDN Finder", true));
761 t.start();
|