Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove netty-all dependency #10818

Merged
merged 13 commits into from
Nov 7, 2022
Merged
16 changes: 10 additions & 6 deletions dubbo-dependencies-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -193,6 +195,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>${netty4_version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
Expand All @@ -203,11 +212,6 @@
<artifactId>netty</artifactId>
<version>${netty_version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty4_version}</version>
</dependency>
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions dubbo-kubernetes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@
<artifactId>dubbo-metadata-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions dubbo-plugin/dubbo-qos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,5 @@
<artifactId>dubbo-serialization-fastjson2</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>
</dependencies>
</project>
19 changes: 18 additions & 1 deletion dubbo-remoting/dubbo-remoting-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,24 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<artifactId>netty-codec</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this filed change to os auto detected

<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
Expand Down
4 changes: 3 additions & 1 deletion dubbo-remoting/dubbo-remoting-netty4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
<artifactId>dubbo-remoting-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<artifactId>netty-handler-proxy</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
Expand Down
5 changes: 0 additions & 5 deletions dubbo-rpc/dubbo-rpc-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@
<artifactId>resteasy-jaxb-provider</artifactId>
</dependency>

<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>

<!-- swagger -->
<dependency>
<groupId>io.swagger</groupId>
Expand Down
4 changes: 4 additions & 0 deletions dubbo-rpc/dubbo-rpc-triple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static TriRpcStatus getStatus(Throwable throwable, String description) {
return new TriRpcStatus(code, throwable, description);
}
if (throwable instanceof TimeoutException) {
return new TriRpcStatus(TriRpcStatus.Code.DEADLINE_EXCEEDED, throwable, description);
return new TriRpcStatus(Code.DEADLINE_EXCEEDED, throwable, description);
}
return new TriRpcStatus(Code.UNKNOWN, throwable, description);
}
Expand Down Expand Up @@ -165,27 +165,27 @@ private static String encodeComponent(String raw) {
return encoder.toString().substring(2);
}

public static TriRpcStatus.Code httpStatusToGrpcCode(int httpStatusCode) {
public static Code httpStatusToGrpcCode(int httpStatusCode) {
if (httpStatusCode >= 100 && httpStatusCode < 200) {
return TriRpcStatus.Code.INTERNAL;
return Code.INTERNAL;
}
if (httpStatusCode == HttpResponseStatus.BAD_REQUEST.code() ||
httpStatusCode == HttpResponseStatus.REQUEST_HEADER_FIELDS_TOO_LARGE.code()
) {
return TriRpcStatus.Code.INTERNAL;
return Code.INTERNAL;
} else if (httpStatusCode == HttpResponseStatus.UNAUTHORIZED.code()) {
return TriRpcStatus.Code.UNAUTHENTICATED;
return Code.UNAUTHENTICATED;
} else if (httpStatusCode == HttpResponseStatus.FORBIDDEN.code()) {
return TriRpcStatus.Code.PERMISSION_DENIED;
return Code.PERMISSION_DENIED;
} else if (httpStatusCode == HttpResponseStatus.NOT_FOUND.code()) {
return TriRpcStatus.Code.UNIMPLEMENTED;
return Code.UNIMPLEMENTED;
} else if (httpStatusCode == HttpResponseStatus.BAD_GATEWAY.code()
|| httpStatusCode == HttpResponseStatus.TOO_MANY_REQUESTS.code()
|| httpStatusCode == HttpResponseStatus.SERVICE_UNAVAILABLE.code()
|| httpStatusCode == HttpResponseStatus.GATEWAY_TIMEOUT.code()) {
return Code.UNAVAILABLE;
} else {
return TriRpcStatus.Code.UNKNOWN;
return Code.UNKNOWN;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.dubbo.rpc.model.ConsumerModel;
import org.apache.dubbo.rpc.model.MethodDescriptor;
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.support.DemoService;
import org.apache.dubbo.rpc.protocol.tri.support.IGreeter;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand All @@ -43,21 +43,21 @@ class StubInvocationUtilTest {

@Test
void unaryCall() throws Throwable {
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
Invoker<IGreeter> invoker = Mockito.mock(Invoker.class);
URL url = Mockito.mock(URL.class);
ConsumerModel consumerModel = Mockito.mock(ConsumerModel.class);
ServiceDescriptor serviceDescriptor = Mockito.mock(ServiceDescriptor.class);
when(consumerModel.getServiceModel()).thenReturn(serviceDescriptor);
when(url.getServiceModel())
.thenReturn(consumerModel);
when(url.getServiceInterface())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(url.getProtocolServiceKey())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(invoker.getUrl())
.thenReturn(url);
when(invoker.getInterface())
.thenReturn(DemoService.class);
.thenReturn(IGreeter.class);
Result result = Mockito.mock(Result.class);
when(invoker.invoke(any(Invocation.class)))
.thenReturn(result);
Expand All @@ -75,21 +75,21 @@ void unaryCall() throws Throwable {

@Test
void unaryCall2() throws Throwable {
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
Invoker<IGreeter> invoker = Mockito.mock(Invoker.class);
URL url = Mockito.mock(URL.class);
ConsumerModel consumerModel = Mockito.mock(ConsumerModel.class);
ServiceDescriptor serviceDescriptor = Mockito.mock(ServiceDescriptor.class);
when(consumerModel.getServiceModel()).thenReturn(serviceDescriptor);
when(url.getServiceModel())
.thenReturn(consumerModel);
when(url.getServiceInterface())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(url.getProtocolServiceKey())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(invoker.getUrl())
.thenReturn(url);
when(invoker.getInterface())
.thenReturn(DemoService.class);
.thenReturn(IGreeter.class);
Result result = Mockito.mock(Result.class);
when(invoker.invoke(any(Invocation.class)))
.thenThrow(new RuntimeException("a"))
Expand Down Expand Up @@ -118,21 +118,21 @@ void unaryCall2() throws Throwable {

@Test
void testUnaryCall() throws Throwable {
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
Invoker<IGreeter> invoker = Mockito.mock(Invoker.class);
URL url = Mockito.mock(URL.class);
ConsumerModel consumerModel = Mockito.mock(ConsumerModel.class);
ServiceDescriptor serviceDescriptor = Mockito.mock(ServiceDescriptor.class);
when(consumerModel.getServiceModel()).thenReturn(serviceDescriptor);
when(url.getServiceModel())
.thenReturn(consumerModel);
when(url.getServiceInterface())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(url.getProtocolServiceKey())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(invoker.getUrl())
.thenReturn(url);
when(invoker.getInterface())
.thenReturn(DemoService.class);
.thenReturn(IGreeter.class);
Result result = Mockito.mock(Result.class);
String response = "response";
when(invoker.invoke(any(Invocation.class)))
Expand Down Expand Up @@ -168,21 +168,21 @@ public void onCompleted() {

@Test
void biOrClientStreamCall() throws InterruptedException {
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
Invoker<IGreeter> invoker = Mockito.mock(Invoker.class);
URL url = Mockito.mock(URL.class);
ConsumerModel consumerModel = Mockito.mock(ConsumerModel.class);
ServiceDescriptor serviceDescriptor = Mockito.mock(ServiceDescriptor.class);
when(consumerModel.getServiceModel()).thenReturn(serviceDescriptor);
when(url.getServiceModel())
.thenReturn(consumerModel);
when(url.getServiceInterface())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(url.getProtocolServiceKey())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(invoker.getUrl())
.thenReturn(url);
when(invoker.getInterface())
.thenReturn(DemoService.class);
.thenReturn(IGreeter.class);
Result result = Mockito.mock(Result.class);
String response = "response";

Expand Down Expand Up @@ -243,21 +243,21 @@ public void onCompleted() {

@Test
void serverStreamCall() throws InterruptedException {
Invoker<DemoService> invoker = Mockito.mock(Invoker.class);
Invoker<IGreeter> invoker = Mockito.mock(Invoker.class);
URL url = Mockito.mock(URL.class);
ConsumerModel consumerModel = Mockito.mock(ConsumerModel.class);
ServiceDescriptor serviceDescriptor = Mockito.mock(ServiceDescriptor.class);
when(consumerModel.getServiceModel()).thenReturn(serviceDescriptor);
when(url.getServiceModel())
.thenReturn(consumerModel);
when(url.getServiceInterface())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(url.getProtocolServiceKey())
.thenReturn(DemoService.class.getName());
.thenReturn(IGreeter.class.getName());
when(invoker.getUrl())
.thenReturn(url);
when(invoker.getInterface())
.thenReturn(DemoService.class);
.thenReturn(IGreeter.class);
Result result = Mockito.mock(Result.class);
String response = "response";
when(invoker.invoke(any(Invocation.class)))
Expand Down