Skip to content

Commit

Permalink
HDDS-11563. Optimize code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangkangwei committed Oct 17, 2024
1 parent 758584b commit 68e54bd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@
*/
@InterfaceAudience.Private
public interface DNMXBean extends ServiceRuntimeInfo {

String getNamespace();
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ public DNMXBeanImpl(
VersionInfo versionInfo) {
super(versionInfo);
}

public String getNamespace() {
return "";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.IOException;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -41,7 +40,7 @@
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
import org.apache.hadoop.hdds.protocol.SecretKeyProtocol;
import org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.ha.SCMHAUtils;
import org.apache.hadoop.hdds.security.SecurityConfig;
import org.apache.hadoop.hdds.security.symmetric.DefaultSecretKeyClient;
import org.apache.hadoop.hdds.security.symmetric.SecretKeyClient;
Expand Down Expand Up @@ -215,13 +214,7 @@ public void start() {
serviceRuntimeInfo = new DNMXBeanImpl(HddsVersionInfo.HDDS_VERSION_INFO) {
@Override
public String getNamespace() {
String localScmServiceId = conf.getTrimmed(
ScmConfigKeys.OZONE_SCM_DEFAULT_SERVICE_ID);
if (localScmServiceId == null) {
Collection<String> scmServiceIds = conf.getTrimmedStringCollection(OZONE_SCM_SERVICE_IDS_KEY);
return String.join(",", scmServiceIds);
}
return localScmServiceId;
return SCMHAUtils.getScmServiceId(conf);
}
};
serviceRuntimeInfo.setStartTime();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
*/
public interface ServiceRuntimeInfo {

/**
* Gets the namespace of Hadoop.
*
* @return the namespace
*/
default String getNamespace() {
return "";
};

/**
* Gets the version of Hadoop.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
@InterfaceAudience.Private
public interface SCMMXBean extends ServiceRuntimeInfo {

String getNamespace();
/**
* Get the SCM RPC server port that used to listen to datanode requests.
* @return SCM datanode RPC server port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
@InterfaceAudience.Private
public interface OMMXBean extends ServiceRuntimeInfo {

String getNamespace();

String getRpcPort();

List<List<String>> getRatisRoles();
Expand Down

0 comments on commit 68e54bd

Please sign in to comment.