HADOOP-11390 Metrics 2 ganglia provider to include hostname in unresolved address problems. (Varun Saxena via stevel)
This commit is contained in:
parent
2800e73c27
commit
4446512e9e
|
@ -100,6 +100,9 @@ Release 2.7.0 - UNRELEASED
|
|||
HADOOP-11455. KMS and Credential CLI should request confirmation for
|
||||
deletion by default. (Charles Lamb via yliu)
|
||||
|
||||
HADOOP-11390 Metrics 2 ganglia provider to include hostname in
|
||||
unresolved address problems. (Varun Saxena via stevel)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-11323. WritableComparator#compare keeps reference to byte array.
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.metrics2.sink.ganglia;
|
|||
import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
|
@ -255,6 +256,12 @@ public abstract class AbstractGangliaSink implements MetricsSink {
|
|||
protected void emitToGangliaHosts() throws IOException {
|
||||
try {
|
||||
for (SocketAddress socketAddress : metricsServers) {
|
||||
if (socketAddress == null || !(socketAddress instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("Unsupported Address type");
|
||||
InetSocketAddress inetAddress = (InetSocketAddress)socketAddress;
|
||||
if(inetAddress.isUnresolved()) {
|
||||
throw new UnknownHostException("Unresolved host: " + inetAddress);
|
||||
}
|
||||
DatagramPacket packet =
|
||||
new DatagramPacket(buffer, offset, socketAddress);
|
||||
datagramSocket.send(packet);
|
||||
|
|
Loading…
Reference in New Issue