Skip to content

Commit f5f1409

Browse files
author
yifuzhou
committed
Upgrade to jdk21
1 parent 48765e4 commit f5f1409

File tree

667 files changed

+3036
-2199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

667 files changed

+3036
-2199
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v2
24-
- name: Set up JDK 8
24+
- name: Set up JDK 21
2525
uses: actions/setup-java@v2
2626
with:
27-
java-version: '8'
27+
java-version: '21'
2828
distribution: 'adopt'
2929

3030
- name: buildcahe

core/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
<artifactId>curator-recipes</artifactId>
6262
</dependency>
6363
<dependency>
64-
<groupId>org.apache.httpcomponents</groupId>
65-
<artifactId>httpclient</artifactId>
64+
<groupId>org.apache.httpcomponents.client5</groupId>
65+
<artifactId>httpclient5</artifactId>
6666
</dependency>
6767
<dependency>
6868
<groupId>org.apache.curator</groupId>
@@ -76,6 +76,11 @@
7676
<groupId>org.slf4j</groupId>
7777
<artifactId>jcl-over-slf4j</artifactId>
7878
</dependency>
79+
<dependency>
80+
<groupId>commons-codec</groupId>
81+
<artifactId>commons-codec</artifactId>
82+
<version>1.18.0</version>
83+
</dependency>
7984
<dependency>
8085
<groupId>org.lz4</groupId>
8186
<artifactId>lz4-java</artifactId>

core/src/main/java/com/ctrip/xpipe/api/proxy/ProxyProtocol.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.ctrip.xpipe.api.proxy;
22

33
import io.netty.buffer.ByteBuf;
4-
import io.netty.channel.Channel;
54

65
/**
76
* @author chen.zhu

core/src/main/java/com/ctrip/xpipe/api/sso/LogoutHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import com.ctrip.xpipe.api.lifecycle.Ordered;
44
import com.ctrip.xpipe.utils.ServicesUtil;
55

6-
import javax.servlet.http.HttpServletRequest;
7-
import javax.servlet.http.HttpServletResponse;
6+
import jakarta.servlet.http.HttpServletRequest;
7+
import jakarta.servlet.http.HttpServletResponse;
88

99
/**
1010
* @author lepdou 2016-11-08

core/src/main/java/com/ctrip/xpipe/http/HttpClientUtil.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.ctrip.xpipe.http;
22

3-
import org.apache.http.client.methods.CloseableHttpResponse;
4-
import org.apache.http.client.methods.HttpGet;
5-
import org.apache.http.impl.client.CloseableHttpClient;
6-
import org.apache.http.impl.client.HttpClients;
7-
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
8-
import org.apache.http.util.EntityUtils;
3+
import org.apache.hc.client5.http.classic.methods.HttpGet;
4+
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
5+
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
6+
import org.apache.hc.client5.http.impl.classic.HttpClients;
7+
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
8+
import org.apache.hc.core5.http.HttpEntity;
9+
import org.apache.hc.core5.http.ParseException;
10+
import org.apache.hc.core5.http.io.entity.EntityUtils;
911

1012
import java.io.IOException;
1113

@@ -40,18 +42,19 @@ private CloseableHttpClient getHttpClient(){
4042
return httpclient;
4143
}
4244

43-
public String getResultAsString(String address) throws IOException{
45+
public String getResultAsString(String address) throws IOException, ParseException {
4446

4547
HttpGet get = new HttpGet(address);
4648
CloseableHttpResponse response = null;
4749
try{
4850
response = httpClient.execute(get);
49-
String result = EntityUtils.toString(response.getEntity());
50-
if(response.getStatusLine().getStatusCode() != HTTP_STATUS_CODE_200){
51+
if(response.getCode() != HTTP_STATUS_CODE_200){
52+
EntityUtils.consume(response.getEntity());
5153
throw new IllegalStateException("response code not 200");
5254
}
53-
return result;
54-
}finally{
55+
HttpEntity entity = response.getEntity();
56+
return EntityUtils.toString(entity);
57+
} finally{
5558
if(response != null){
5659
response.close();
5760
}

core/src/main/java/com/ctrip/xpipe/http/SimpleHttpResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.ctrip.xpipe.http;
22

3-
import org.apache.http.HttpResponse;
3+
import org.apache.hc.core5.http.HttpResponse;
44

55
/**
66
* @author wenchao.meng
@@ -16,12 +16,12 @@ public SimpleHttpResponse(HttpResponse httpResponse){
1616
}
1717

1818
public int getStatusCode(){
19-
return httpResponse.getStatusLine().getStatusCode();
19+
return httpResponse.getCode();
2020
}
2121

2222
public boolean isSuccess(){
2323

24-
return httpResponse.getStatusLine().getStatusCode() == HttpClientUtil.HTTP_STATUS_CODE_200;
24+
return httpResponse.getCode() == HttpClientUtil.HTTP_STATUS_CODE_200;
2525
}
2626

2727

core/src/main/java/com/ctrip/xpipe/migration/DefaultOuterClientService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.ctrip.xpipe.endpoint.ClusterShardHostPort;
55
import com.ctrip.xpipe.endpoint.HostPort;
66
import com.ctrip.xpipe.utils.DateTimeUtils;
7-
import com.ctrip.xpipe.utils.VisibleForTesting;
87
import com.google.common.collect.Lists;
98

109
import java.net.InetSocketAddress;

core/src/main/java/com/ctrip/xpipe/monitor/CatConfig.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.springframework.context.annotation.Configuration;
1010
import org.springframework.context.annotation.Profile;
1111

12-
import javax.servlet.DispatcherType;
12+
import jakarta.servlet.DispatcherType;
1313

1414
/**
1515
* @author wenchao.meng
@@ -28,16 +28,7 @@ public static boolean isCatenabled() {
2828
return catEnabled;
2929
}
3030

31-
@Bean
32-
public FilterRegistrationBean catFilter() {
33-
34-
FilterRegistrationBean bean = new FilterRegistrationBean();
35-
bean.setFilter(new CatFilter());
36-
bean.setName("cat-filter");
37-
bean.addUrlPatterns("/*");
38-
bean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD);
39-
return bean;
40-
}
31+
// catFilter() delete, because of @WebFilter has register it
4132

4233
@Bean(name="cat-listener")
4334
public ServletListenerRegistrationBean<CatListener> catListener() {

core/src/main/java/com/ctrip/xpipe/netty/commands/NettyClientFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.ctrip.xpipe.netty.commands;
22

33
import com.ctrip.xpipe.api.endpoint.Endpoint;
4-
import com.ctrip.xpipe.api.proxy.ProxyEnabled;
54
import com.ctrip.xpipe.lifecycle.AbstractStartStoppable;
65
import com.ctrip.xpipe.netty.NettySimpleMessageHandler;
76
import com.ctrip.xpipe.utils.ThreadUtils;

core/src/main/java/com/ctrip/xpipe/netty/commands/NettyKeyedPoolClientFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.ctrip.xpipe.api.endpoint.Endpoint;
44
import com.ctrip.xpipe.lifecycle.AbstractStartStoppable;
5-
import com.ctrip.xpipe.netty.NettySimpleMessageHandler;
65
import com.ctrip.xpipe.pool.ChannelHandlerFactory;
76
import com.ctrip.xpipe.pool.DefaultChannelHandlerFactory;
87
import com.ctrip.xpipe.utils.FastThreadLocalThreadFactory;
@@ -11,7 +10,6 @@
1110
import io.netty.channel.nio.NioEventLoopGroup;
1211
import io.netty.channel.socket.SocketChannel;
1312
import io.netty.channel.socket.nio.NioSocketChannel;
14-
import io.netty.handler.logging.LoggingHandler;
1513
import org.apache.commons.pool2.KeyedPooledObjectFactory;
1614
import org.apache.commons.pool2.PooledObject;
1715
import org.apache.commons.pool2.impl.DefaultPooledObject;

0 commit comments

Comments
 (0)