Skip to content

Commit e433b37

Browse files
authored
HDDS-14664. Remove unused OmUtils.getOmAddressForClients (#9791)
1 parent 9b864d4 commit e433b37

File tree

2 files changed

+7
-31
lines changed

2 files changed

+7
-31
lines changed

hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,6 @@ public static String getOmRpcAddress(ConfigurationSource conf,
173173
}
174174
}
175175

176-
/**
177-
* Retrieve the socket address that should be used by clients to connect
178-
* to OM.
179-
* @param conf
180-
* @return Target InetSocketAddress for the OM service endpoint.
181-
*/
182-
public static InetSocketAddress getOmAddressForClients(
183-
ConfigurationSource conf) {
184-
final Optional<String> host = getHostNameFromConfigKeys(conf,
185-
OZONE_OM_ADDRESS_KEY);
186-
187-
if (!host.isPresent()) {
188-
throw new IllegalArgumentException(
189-
OZONE_OM_ADDRESS_KEY + " must be defined. See" +
190-
" https://wiki.apache.org/hadoop/Ozone#Configuration for" +
191-
" details on configuring Ozone.");
192-
}
193-
194-
return NetUtils.createSocketAddr(
195-
host.get() + ":" + getOmRpcPort(conf));
196-
}
197-
198176
/**
199177
* Returns true if OZONE_OM_SERVICE_IDS_KEY is defined and not empty.
200178
* @param conf Configuration

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerRestInterface.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@
1818
package org.apache.hadoop.ozone.om;
1919

2020
import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForClients;
21-
import static org.apache.hadoop.ozone.OmUtils.getOmAddressForClients;
2221
import static org.junit.jupiter.api.Assertions.assertEquals;
2322
import static org.junit.jupiter.api.Assertions.assertTrue;
2423

2524
import com.fasterxml.jackson.core.type.TypeReference;
2625
import com.fasterxml.jackson.databind.ObjectMapper;
2726
import java.net.InetSocketAddress;
2827
import java.util.HashMap;
28+
import java.util.Iterator;
2929
import java.util.List;
3030
import java.util.Map;
3131
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
3232
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
3333
import org.apache.hadoop.net.NetUtils;
3434
import org.apache.hadoop.ozone.MiniOzoneCluster;
35+
import org.apache.hadoop.ozone.OmUtils;
3536
import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
3637
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServicePort;
3738
import org.apache.http.HttpResponse;
@@ -80,19 +81,16 @@ public void testGetServiceList() throws Exception {
8081
serviceMap.put(serviceInfo.getNodeType(), serviceInfo);
8182
}
8283

83-
InetSocketAddress omAddress =
84-
getOmAddressForClients(conf);
84+
String omAddress = OmUtils.getOmRpcAddress(conf);
8585
ServiceInfo omInfo = serviceMap.get(HddsProtos.NodeType.OM);
8686

87-
assertEquals(omAddress.getHostName(), omInfo.getHostname());
88-
assertEquals(omAddress.getPort(),
89-
omInfo.getPort(ServicePort.Type.RPC));
87+
assertEquals(omAddress, omInfo.getHostname() + ":" + omInfo.getPort(ServicePort.Type.RPC));
9088
assertEquals(server.getHttpAddress().getPort(),
9189
omInfo.getPort(ServicePort.Type.HTTP));
9290

93-
assertTrue(getScmAddressForClients(conf).iterator().hasNext());
94-
InetSocketAddress scmAddress =
95-
getScmAddressForClients(conf).iterator().next();
91+
Iterator<InetSocketAddress> scmAddressIterator = getScmAddressForClients(conf).iterator();
92+
assertTrue(scmAddressIterator.hasNext());
93+
InetSocketAddress scmAddress = scmAddressIterator.next();
9694
ServiceInfo scmInfo = serviceMap.get(HddsProtos.NodeType.SCM);
9795

9896
assertEquals(scmAddress.getHostName(), scmInfo.getHostname());

0 commit comments

Comments
 (0)