Skip to content

Commit

Permalink
fix(servlet): Some protocol config read bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
oxsean committed Jun 16, 2024
1 parent 9962366 commit 7a76196
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public interface Constants {
String H2_SETTINGS_PASS_THROUGH_STANDARD_HTTP_HEADERS = "dubbo.rpc.tri.pass-through-standard-http-headers";

String H3_SETTINGS_HTTP3_ENABLE = "dubbo.protocol.triple.enable-http3";
String H3_SETTINGS_SERVLET_ENABLE = "dubbo.protocol.triple.enable-servlet";

String ADAPTIVE_LOADBALANCE_ATTACHMENT_KEY = "lb_adaptive";
String ADAPTIVE_LOADBALANCE_START_TIME = "adaptive_startTime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.apache.dubbo.common.threadpool.manager.ExecutorRepository;
import org.apache.dubbo.common.utils.ExecutorUtil;
import org.apache.dubbo.common.utils.NetUtils;
import org.apache.dubbo.config.context.ConfigManager;
import org.apache.dubbo.config.nested.TripleConfig;
import org.apache.dubbo.remoting.api.connection.AbstractConnectionClient;
import org.apache.dubbo.remoting.api.pu.DefaultPuHandler;
import org.apache.dubbo.remoting.exchange.Http3Exchanger;
Expand Down Expand Up @@ -61,6 +59,7 @@
import static org.apache.dubbo.rpc.Constants.H2_SETTINGS_RESOLVE_FALLBACK_TO_DEFAULT_KEY;
import static org.apache.dubbo.rpc.Constants.H2_SETTINGS_SUPPORT_NO_LOWER_HEADER_KEY;
import static org.apache.dubbo.rpc.Constants.H3_SETTINGS_HTTP3_ENABLE;
import static org.apache.dubbo.rpc.Constants.H3_SETTINGS_SERVLET_ENABLE;
import static org.apache.dubbo.rpc.Constants.HTTP3_KEY;

public class TripleProtocol extends AbstractProtocol {
Expand All @@ -77,6 +76,7 @@ public class TripleProtocol extends AbstractProtocol {
public static boolean RESOLVE_FALLBACK_TO_DEFAULT = true;
public static boolean PASS_THROUGH_STANDARD_HTTP_HEADERS = false;
public static boolean HTTP3_ENABLED = false;
public static boolean SERVLET_ENABLED = false;

public TripleProtocol(FrameworkModel frameworkModel) {
this.frameworkModel = frameworkModel;
Expand All @@ -94,6 +94,7 @@ public TripleProtocol(FrameworkModel frameworkModel) {

Configuration globalConf = ConfigurationUtils.getGlobalConfiguration(frameworkModel.defaultApplication());
HTTP3_ENABLED = globalConf.getBoolean(H3_SETTINGS_HTTP3_ENABLE, false);
SERVLET_ENABLED = globalConf.getBoolean(H3_SETTINGS_SERVLET_ENABLE, false);
}

@Override
Expand Down Expand Up @@ -170,9 +171,8 @@ public void afterUnExport() {
ExecutorRepository.getInstance(url.getOrDefaultApplicationModel())
.createExecutorIfAbsent(ExecutorUtil.setThreadName(url, SERVER_THREAD_POOL_NAME));

TripleConfig tripleConfig = ConfigManager.getProtocol(url).getTriple();
boolean bindPort = true;
if (Boolean.TRUE.equals(tripleConfig.getEnableServlet())) {
if (SERVLET_ENABLED) {
int port = url.getParameter(BIND_PORT_KEY, url.getPort());
Integer serverPort = ServletExchanger.getServerPort();
if (serverPort == null) {
Expand Down

0 comments on commit 7a76196

Please sign in to comment.