< prev index next >

src/java.base/share/classes/java/net/InetAddress.java

Print this page




 291 
 292     /* Used to store the name service provider */
 293     private static transient NameService nameService = null;
 294 
 295     /**
 296      * Used to store the best available hostname.
 297      * Lazily initialized via a data race; safe because Strings are immutable.
 298      */
 299     private transient String canonicalHostName = null;
 300 
 301     /** use serialVersionUID from JDK 1.0.2 for interoperability */
 302     private static final long serialVersionUID = 3286316764910316507L;
 303 
 304     /*
 305      * Load net library into runtime, and perform initializations.
 306      */
 307     static {
 308         String str = java.security.AccessController.doPrivileged(
 309                 new GetPropertyAction("java.net.preferIPv6Addresses"));
 310         if (str == null) {
 311             preferIPv6Address = PREFER_IPV4_VALUE;
 312         } else if (str.equalsIgnoreCase("true")) {
 313             preferIPv6Address = PREFER_IPV6_VALUE;
 314         } else if (str.equalsIgnoreCase("false")) {
 315             preferIPv6Address = PREFER_IPV4_VALUE;
 316         } else if (str.equalsIgnoreCase("system")) {
 317             preferIPv6Address = PREFER_SYSTEM_VALUE;
 318         } else {
 319             preferIPv6Address = PREFER_IPV4_VALUE;
 320         }
 321         AccessController.doPrivileged(
 322             new java.security.PrivilegedAction<>() {
 323                 public Void run() {
 324                     System.loadLibrary("net");
 325                     return null;
 326                 }
 327             });
 328         SharedSecrets.setJavaNetInetAddressAccess(
 329                 new JavaNetInetAddressAccess() {
 330                     public String getOriginalHostName(InetAddress ia) {
 331                         return ia.holder.getOriginalHostName();




 291 
 292     /* Used to store the name service provider */
 293     private static transient NameService nameService = null;
 294 
 295     /**
 296      * Used to store the best available hostname.
 297      * Lazily initialized via a data race; safe because Strings are immutable.
 298      */
 299     private transient String canonicalHostName = null;
 300 
 301     /** use serialVersionUID from JDK 1.0.2 for interoperability */
 302     private static final long serialVersionUID = 3286316764910316507L;
 303 
 304     /*
 305      * Load net library into runtime, and perform initializations.
 306      */
 307     static {
 308         String str = java.security.AccessController.doPrivileged(
 309                 new GetPropertyAction("java.net.preferIPv6Addresses"));
 310         if (str == null) {
 311             preferIPv6Address = PREFER_IPV6_VALUE;
 312         } else if (str.equalsIgnoreCase("true")) {
 313             preferIPv6Address = PREFER_IPV6_VALUE;
 314         } else if (str.equalsIgnoreCase("false")) {
 315             preferIPv6Address = PREFER_IPV4_VALUE;
 316         } else if (str.equalsIgnoreCase("system")) {
 317             preferIPv6Address = PREFER_SYSTEM_VALUE;
 318         } else {
 319             preferIPv6Address = PREFER_IPV4_VALUE;
 320         }
 321         AccessController.doPrivileged(
 322             new java.security.PrivilegedAction<>() {
 323                 public Void run() {
 324                     System.loadLibrary("net");
 325                     return null;
 326                 }
 327             });
 328         SharedSecrets.setJavaNetInetAddressAccess(
 329                 new JavaNetInetAddressAccess() {
 330                     public String getOriginalHostName(InetAddress ia) {
 331                         return ia.holder.getOriginalHostName();


< prev index next >