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

Reviewed-by: chegar
This commit is contained in:
Alan Bateman 2019-12-04 16:37:00 +00:00
parent 386b387ef2
commit e7d68cd13b
10 changed files with 438 additions and 159 deletions

View file

@ -310,6 +310,13 @@ class Inet4Address extends InetAddress {
return addr;
}
/**
* Returns the 32-bit IPv4 address.
*/
int addressValue() {
return holder().getAddress();
}
/**
* Returns the IP address string in textual presentation form.
*

View file

@ -793,6 +793,7 @@ class Inet6Address extends InetAddress {
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 @@ class Inet6Address extends InetAddress {
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 @@ class Inet6Address extends InetAddress {
* @since 1.5
*/
public int getScopeId() {
return holder6.scope_id;
return holder6.scope_id;
}
/**
@ -825,7 +833,7 @@ class Inet6Address extends InetAddress {
* @since 1.5
*/
public NetworkInterface getScopedInterface() {
return holder6.scope_ifname;
return holder6.scope_ifname;
}
/**

View file

@ -326,10 +326,18 @@ public class InetAddress implements java.io.Serializable {
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();