Skip to content

Commit

Permalink
Remove redundant code in ServiceConfig#checkAndUpdateSubConfigs method (
Browse files Browse the repository at this point in the history
#8036)

* Remove redundant code in ServiceConfig#checkAndUpdateSubConfigs method

* Remove unused import
  • Loading branch information
BurningCN committed Jun 15, 2021
1 parent a7697f8 commit cfe3bab
Showing 1 changed file with 1 addition and 31 deletions.
Expand Up @@ -23,7 +23,6 @@
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.ClassUtils;
import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.common.utils.ConfigUtils;
import org.apache.dubbo.common.utils.NamedThreadFactory;
Expand Down Expand Up @@ -294,36 +293,7 @@ private void checkAndUpdateSubConfigs() {
checkRef();
generic = FALSE_VALUE;
}
if (local != null) {
if (TRUE_VALUE.equals(local)) {
local = interfaceName + LOCAL_SUFFIX;
}
Class<?> localClass;
try {
localClass = ClassUtils.forNameWithThreadContextClassLoader(local);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e.getMessage(), e);
}
if (!interfaceClass.isAssignableFrom(localClass)) {
throw new IllegalStateException(
"The local implementation class " + localClass.getName() + " not implement interface " + interfaceName);
}
}
if (stub != null) {
if (TRUE_VALUE.equals(stub)) {
stub = interfaceName + STUB_SUFFIX;
}
Class<?> stubClass;
try {
stubClass = ClassUtils.forNameWithThreadContextClassLoader(stub);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e.getMessage(), e);
}
if (!interfaceClass.isAssignableFrom(stubClass)) {
throw new IllegalStateException(
"The stub implementation class " + stubClass.getName() + " not implement interface " + interfaceName);
}
}

checkStubAndLocal(interfaceClass);
ConfigValidationUtils.checkMock(interfaceClass, this);
ConfigValidationUtils.validateServiceConfig(this);
Expand Down

0 comments on commit cfe3bab

Please sign in to comment.