Skip to content
Permalink
Browse files

8235193: (dc) Remove JNI overhead from DatagramChannel.send implement…

…ation

Reviewed-by: chegar
  • Loading branch information
Alan Bateman
Alan Bateman committed Dec 4, 2019
1 parent 386b387 commit e7d68cd13b288199a421bf33d307f3ded8ae47d8
@@ -310,6 +310,13 @@ public boolean isMCOrgLocal() {
return addr;
}

/**
* Returns the 32-bit IPv4 address.
*/
int addressValue() {
return holder().getAddress();
}

/**
* Returns the IP address string in textual presentation form.
*
@@ -793,6 +793,7 @@ public boolean isMCSiteLocal() {
public boolean isMCOrgLocal() {
return holder6.isMCOrgLocal();
}

/**
* Returns the raw IP address of this {@code InetAddress} object. The result
* is in network byte order: the highest order byte of the address is in
@@ -805,6 +806,13 @@ public boolean isMCOrgLocal() {
return holder6.ipaddress.clone();
}

/**
* Returns a reference to the byte[] with the IPv6 address.
*/
byte[] addressBytes() {
return holder6.ipaddress;
}

/**
* Returns the numeric scopeId, if this instance is associated with
* an interface. If no scoped_id is set, the returned value is zero.
@@ -814,7 +822,7 @@ public boolean isMCOrgLocal() {
* @since 1.5
*/
public int getScopeId() {
return holder6.scope_id;
return holder6.scope_id;
}

/**
@@ -825,7 +833,7 @@ public int getScopeId() {
* @since 1.5
*/
public NetworkInterface getScopedInterface() {
return holder6.scope_ifname;
return holder6.scope_ifname;
}

/**
@@ -326,10 +326,18 @@ public String getOriginalHostName(InetAddress ia) {

public InetAddress getByName(String hostName,
InetAddress hostAddress)
throws UnknownHostException
throws UnknownHostException
{
return InetAddress.getByName(hostName, hostAddress);
}

public int addressValue(Inet4Address inet4Address) {
return inet4Address.addressValue();
}

public byte[] addressBytes(Inet6Address inet6Address) {
return inet6Address.addressBytes();
}
}
);
init();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@

package jdk.internal.access;

import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

@@ -43,4 +45,14 @@
*/
InetAddress getByName(String hostName, InetAddress hostAddress)
throws UnknownHostException;

/**
* Returns the 32-bit IPv4 address.
*/
int addressValue(Inet4Address inet4Address);

/**
* Returns a reference to the byte[] with the IPv6 address.
*/
byte[] addressBytes(Inet6Address inet6Address);
}

0 comments on commit e7d68cd

Please sign in to comment.
You can’t perform that action at this time.