Skip to content

Commit

Permalink
[type:improve] Get rid of the dead code and add some improvements (#5789
Browse files Browse the repository at this point in the history
)

* [type:improve] Get rid of the dead code and add some improvements

* [type:improve] Get rid of the dead code and add some improvements

---------

Co-authored-by: aias00 <[email protected]>
Co-authored-by: xiaoyu <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent 49f6298 commit cc76d4a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

package org.apache.shenyu.admin.listener.websocket;

import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpSession;
import jakarta.websocket.HandshakeResponse;
import jakarta.websocket.server.HandshakeRequest;
import jakarta.websocket.server.ServerEndpointConfig;
import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.admin.config.properties.WebsocketSyncProperties;
import org.apache.shenyu.admin.spring.SpringBeanUtils;
Expand All @@ -28,13 +33,6 @@
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Configuration;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpSession;
import jakarta.websocket.HandshakeResponse;
import jakarta.websocket.server.HandshakeRequest;
import jakarta.websocket.server.ServerEndpointConfig;

import static org.apache.tomcat.websocket.server.Constants.BINARY_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM;
import static org.apache.tomcat.websocket.server.Constants.TEXT_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM;

Expand Down Expand Up @@ -77,7 +75,7 @@ public boolean checkOrigin(final String originHeaderValue) {
}

@Override
public void onStartup(final ServletContext servletContext) throws ServletException {
public void onStartup(final ServletContext servletContext) {
int messageMaxSize = websocketSyncProperties.getMessageMaxSize();
if (messageMaxSize > 0) {
servletContext.setInitParameter(TEXT_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* This is condition strategy.
*/
@SPI
@FunctionalInterface
public interface MatchStrategy {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.shenyu.springboot.starter.client.springmvc;

import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.client.auto.config.ClientRegisterConfiguration;
import org.apache.shenyu.client.core.constant.ShenyuClientConstants;
Expand Down Expand Up @@ -66,7 +67,7 @@ public SpringMvcClientEventListener springHttpClientEventListener(final ShenyuCl
final ShenyuClientRegisterRepository shenyuClientRegisterRepository,
final Environment env) {
ClientPropertiesConfig clientPropertiesConfig = clientConfig.getClient().get(RpcTypeEnum.HTTP.getName());
Properties props = clientPropertiesConfig == null ? null : clientPropertiesConfig.getProps();
Properties props = Optional.ofNullable(clientPropertiesConfig).map(ClientPropertiesConfig::getProps).orElse(null);
String applicationName = env.getProperty("spring.application.name");
String discoveryMode = env.getProperty("shenyu.discovery.type", ShenyuClientConstants.DISCOVERY_LOCAL_MODE);
if (props != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ private void masterCheck() {
}
}
}
// String masterUrl = "";
Iterator<ShenyuWebsocketClient> iterator = clients.iterator();
while (iterator.hasNext()) {
ShenyuWebsocketClient websocketClient = iterator.next();
Expand Down

0 comments on commit cc76d4a

Please sign in to comment.