< prev index next >

src/java.base/share/native/libnet/net_util.c

Print this page
rev 59105 : imported patch corelibs


  64 
  65     iCls = (*env)->FindClass(env, "java/lang/Boolean");
  66     CHECK_NULL_RETURN(iCls, JNI_VERSION_1_2);
  67     mid = (*env)->GetStaticMethodID(env, iCls, "getBoolean", "(Ljava/lang/String;)Z");
  68     CHECK_NULL_RETURN(mid, JNI_VERSION_1_2);
  69     s = (*env)->NewStringUTF(env, "java.net.preferIPv4Stack");
  70     CHECK_NULL_RETURN(s, JNI_VERSION_1_2);
  71     preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s);
  72 
  73     /*
  74      * Since we have initialized and loaded the socket library we will
  75      * check now whether we have IPv6 on this platform and if the
  76      * supporting socket APIs are available
  77      */
  78     IPv4_available = IPv4_supported();
  79     IPv6_available = IPv6_supported() & (!preferIPv4Stack);
  80 
  81     /* check if SO_REUSEPORT is supported on this platform */
  82     REUSEPORT_available = reuseport_supported();
  83     platformInit();
  84     parseExclusiveBindProperty(env);
  85 
  86     return JNI_VERSION_1_2;
  87 }
  88 
  89 static int initialized = 0;
  90 
  91 JNIEXPORT void JNICALL initInetAddressIDs(JNIEnv *env) {
  92     if (!initialized) {
  93         Java_java_net_InetAddress_init(env, 0);
  94         JNU_CHECK_EXCEPTION(env);
  95         Java_java_net_Inet4Address_init(env, 0);
  96         JNU_CHECK_EXCEPTION(env);
  97         Java_java_net_Inet6Address_init(env, 0);
  98         JNU_CHECK_EXCEPTION(env);
  99         initialized = 1;
 100     }
 101 }
 102 
 103 /* The address, and family fields used to be in InetAddress
 104  * but are now in an implementation object. So, there is an extra




  64 
  65     iCls = (*env)->FindClass(env, "java/lang/Boolean");
  66     CHECK_NULL_RETURN(iCls, JNI_VERSION_1_2);
  67     mid = (*env)->GetStaticMethodID(env, iCls, "getBoolean", "(Ljava/lang/String;)Z");
  68     CHECK_NULL_RETURN(mid, JNI_VERSION_1_2);
  69     s = (*env)->NewStringUTF(env, "java.net.preferIPv4Stack");
  70     CHECK_NULL_RETURN(s, JNI_VERSION_1_2);
  71     preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s);
  72 
  73     /*
  74      * Since we have initialized and loaded the socket library we will
  75      * check now whether we have IPv6 on this platform and if the
  76      * supporting socket APIs are available
  77      */
  78     IPv4_available = IPv4_supported();
  79     IPv6_available = IPv6_supported() & (!preferIPv4Stack);
  80 
  81     /* check if SO_REUSEPORT is supported on this platform */
  82     REUSEPORT_available = reuseport_supported();
  83     platformInit();

  84 
  85     return JNI_VERSION_1_2;
  86 }
  87 
  88 static int initialized = 0;
  89 
  90 JNIEXPORT void JNICALL initInetAddressIDs(JNIEnv *env) {
  91     if (!initialized) {
  92         Java_java_net_InetAddress_init(env, 0);
  93         JNU_CHECK_EXCEPTION(env);
  94         Java_java_net_Inet4Address_init(env, 0);
  95         JNU_CHECK_EXCEPTION(env);
  96         Java_java_net_Inet6Address_init(env, 0);
  97         JNU_CHECK_EXCEPTION(env);
  98         initialized = 1;
  99     }
 100 }
 101 
 102 /* The address, and family fields used to be in InetAddress
 103  * but are now in an implementation object. So, there is an extra


< prev index next >