Skip to content

Commit

Permalink
use throw
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ committed Jun 20, 2023
1 parent 76bd7e3 commit 2aee96c
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.config.ConfigurationUtils;
import org.apache.dubbo.common.constants.LoggerCodeConstants;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.threadpool.manager.ExecutorRepository;
import org.apache.dubbo.common.utils.ExecutorUtil;
Expand Down Expand Up @@ -54,7 +53,7 @@ public class TripleProtocol extends AbstractProtocol {


public static final String METHOD_ATTR_PACK = "pack";
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(TripleProtocol.class);
private static final Logger logger = LoggerFactory.getLogger(TripleProtocol.class);
private final PathResolver pathResolver;
private final TriBuiltinService triBuiltinService;
private final String acceptEncodings;
Expand Down Expand Up @@ -116,12 +115,13 @@ public void afterUnExport() {

Invoker<?> previous = pathResolver.add(url.getServiceKey(), invoker);
if (previous != null) {
String msg = "Already exists an invoker[" + previous.getUrl() + "] on path[" + url.getServiceKey()
+ "], dubbo will override with invoker[" + url + "]";
if (url.getServiceKey().equals(url.getServiceModel().getServiceModel().getInterfaceName())) {
logger.info(msg);
logger.info("Already exists an invoker[" + previous.getUrl() + "] on path[" + url.getServiceKey()
+ "], dubbo will override with invoker[" + url + "]");
} else {
logger.warn(LoggerCodeConstants.PROTOCOL_INCORRECT_PARAMETER_VALUES, "", "", msg);
throw new IllegalStateException("Already exists an invoker[" + previous.getUrl() + "] on path[" +
url.getServiceKey() + "], failed to add invoker[" + url +
"] , please use unique serviceKey.");
}
}
if (RESOLVE_FALLBACK_TO_DEFAULT) {
Expand Down

0 comments on commit 2aee96c

Please sign in to comment.