Repository: incubator-ratis Updated Branches: refs/heads/master dc182838b -> 717e46d49
RATIS-42. Shade netty in ratis. Contributed by Tsz Wo Nicholas Sze. Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/717e46d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/717e46d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/717e46d4 Branch: refs/heads/master Commit: 717e46d4974efd5e0581cb99903f48b52bc624cd Parents: dc18283 Author: Jing Zhao <[email protected]> Authored: Fri Mar 17 14:58:01 2017 -0700 Committer: Jing Zhao <[email protected]> Committed: Fri Mar 17 14:58:01 2017 -0700 ---------------------------------------------------------------------- pom.xml | 23 +- ratis-examples/pom.xml | 5 + ratis-netty-shaded/.gitignore | 2 + ratis-netty-shaded/pom.xml | 495 +++++++++++++++++++ ratis-netty/pom.xml | 11 +- .../org/apache/ratis/netty/NettyClient.java | 23 +- .../org/apache/ratis/netty/NettyRpcProxy.java | 29 +- .../ratis/netty/server/NettyRpcService.java | 14 +- ratis-proto-shaded/pom.xml | 73 +-- 9 files changed, 576 insertions(+), 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index a62c384..ff1d64f 100644 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ <module>ratis-grpc</module> <module>ratis-hadoop</module> <module>ratis-netty</module> + <module>ratis-netty-shaded</module> <module>ratis-proto-shaded</module> <module>ratis-server</module> </modules> @@ -163,6 +164,9 @@ <java.min.version>${javac.version}</java.min.version> <maven.min.version>3.0.4</maven.min.version> + <!--Version of protobuf to be shaded --> + <shaded.protobuf.version>3.1.0</shaded.protobuf.version> + <!-- dependency versions --> <commons-io.version>2.4</commons-io.version> <commons-lang.version>2.6</commons-lang.version> @@ -256,6 +260,19 @@ </dependency> <dependency> + <artifactId>ratis-netty-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + <version>${project.version}</version> + </dependency> + <dependency> + <artifactId>ratis-netty-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> <artifactId>ratis-proto-shaded</artifactId> <groupId>org.apache.ratis</groupId> <version>${project.version}</version> @@ -312,12 +329,6 @@ </dependency> <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - <version>4.1.6.Final</version> - </dependency> - - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-examples/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml index 41ab6ce..d73e080 100644 --- a/ratis-examples/pom.xml +++ b/ratis-examples/pom.xml @@ -105,6 +105,11 @@ <scope>test</scope> <type>test-jar</type> </dependency> + <dependency> + <artifactId>ratis-netty-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.slf4j</groupId> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-netty-shaded/.gitignore ---------------------------------------------------------------------- diff --git a/ratis-netty-shaded/.gitignore b/ratis-netty-shaded/.gitignore new file mode 100644 index 0000000..ce50505 --- /dev/null +++ b/ratis-netty-shaded/.gitignore @@ -0,0 +1,2 @@ +src/main/java +dependency-reduced-pom.xml http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-netty-shaded/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-netty-shaded/pom.xml b/ratis-netty-shaded/pom.xml new file mode 100644 index 0000000..b87b27e --- /dev/null +++ b/ratis-netty-shaded/pom.xml @@ -0,0 +1,495 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + 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. See accompanying LICENSE file. +--> +<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> + <artifactId>ratis</artifactId> + <groupId>org.apache.ratis</groupId> + <version>0.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + + <artifactId>ratis-netty-shaded</artifactId> + <name>Ratis Netty Shaded</name> + <version>0.1-SNAPSHOT</version> + + <properties> + <maven.javadoc.skip>true</maven.javadoc.skip> + <!--The Default target dir--> + <classes.dir>${project.build.directory}/classes</classes.dir> + <!--The Default location for sources--> + <sources.dir>src/main/java</sources.dir> + + <!--Version of Netty to be shaded --> + <shaded.netty.version>4.1.3.Final</shaded.netty.version> + </properties> + + <build> + <!--I want to override these in profile so define them + with variables up here--> + <sourceDirectory>${sources.dir}</sourceDirectory> + <outputDirectory>${classes.dir}</outputDirectory> + <plugins> + <!-- Make a jar and put the sources in the jar --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>${maven-source-plugin.version}</version> + </plugin> + <plugin> + <!--Make it so assembly:single does nothing in here--> + <artifactId>maven-assembly-plugin</artifactId> + <version>${maven-assembly-plugin.version}</version> + <configuration> + <skipAssembly>true</skipAssembly> + </configuration> + </plugin> + </plugins> + </build> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + <version>${shaded.netty.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <artifactId>ratis-proto-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version>${shaded.protobuf.version}</version> + </dependency> + <dependency> + <groupId>com.google.protobuf.nano</groupId> + <artifactId>protobuf-javanano</artifactId> + <version>${shaded.protobuf.version}</version> + </dependency> + + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + <version>${shaded.netty.version}</version> + </dependency> + + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-buffer</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-dns</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-haproxy</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-http</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-http2</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-memcache</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-mqtt</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-socks</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-stomp</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-common</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-handler</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-handler-proxy</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-resolver</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-resolver-dns</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-transport</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-transport-rxtx</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-transport-sctp</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-transport-udt</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-example</artifactId> + <version>${shaded.netty.version}</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>org.jboss.marshalling</groupId> + <artifactId>jboss-marshalling</artifactId> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>com.jcraft</groupId> + <artifactId>jzlib</artifactId> + <version>1.1.3</version> + </dependency> + <dependency> + <groupId>com.ning</groupId> + <artifactId>compress-lzf</artifactId> + <version>1.0.3</version> + </dependency> + <dependency> + <groupId>net.jpountz.lz4</groupId> + <artifactId>lz4</artifactId> + <version>1.3.0</version> + </dependency> + <dependency> + <groupId>com.github.jponge</groupId> + <artifactId>lzma-java</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpkix-jdk15on</artifactId> + <version>1.54</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.8.0</version> + <scope>compile</scope> + <optional>true</optional> + </dependency> + + <dependency> + <groupId>org.eclipse.jetty.npn</groupId> + <artifactId>npn-api</artifactId> + <version>1.1.1.v20141010</version> + <scope>provided</scope> <!-- Provided by npn-boot --> + </dependency> + <dependency> + <groupId>org.eclipse.jetty.alpn</groupId> + <artifactId>alpn-api</artifactId> + <version>1.1.2.v20150522</version> + <scope>provided</scope> <!-- Provided by alpn-boot --> + </dependency> + + <dependency> + <groupId>org.jctools</groupId> + <artifactId>jctools-core</artifactId> + <version>1.2.1</version> + </dependency> + + </dependencies> + + <profiles> + <!-- Skip the tests in this module --> + <profile> + <id>skip-shaded-tests</id> + <activation> + <property> + <name>skip-shaded-tests</name> + </property> + </activation> + <properties> + <surefire.skipFirstPart>true</surefire.skipFirstPart> + </properties> + </profile> + + <profile> + <id>skipShade</id> + <activation> + <file> + <exists>${sources.dir}</exists> + </file> + <property> + <name>!shade-netty</name> + </property> + </activation> + </profile> + + <profile> + <id>shade-netty</id> + <!-- + Shade and drop the generated java files under src/main/java. + --> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <profile.id>shade-netty</profile.id> + <!--When the compile for this profile runs, make sure it makes jars that + can be related back to this shading profile. Give them a shading prefix. + --> + <jar.finalName>${profile.id}.${project.artifactId}-${project.version}</jar.finalName> + </properties> + <build> + <finalName>${jar.finalName}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>2.4.3</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <shadeSourcesContent>true</shadeSourcesContent> + <createSourcesJar>true</createSourcesJar> + <relocations> + <relocation> + <pattern>com.google.protobuf</pattern> + <shadedPattern>org.apache.ratis.shaded.com.google.protobuf</shadedPattern> + </relocation> + <relocation> + <pattern>io.netty</pattern> + <shadedPattern>org.apache.ratis.shaded.io.netty</shadedPattern> + </relocation> + </relocations> + + <filters> + <filter> + <artifact>io.netty:netty-all</artifact> + <includes> + <include>io/netty/**</include> + </includes> + </filter> + </filters> + + <artifactSet> + <excludes> + <exclude>com.barchart.udt:barchart-udt-bundle</exclude> + <exclude>com.github.jponge:lzma-java</exclude> + + <exclude>com.google.code.gson:gson</exclude> + <exclude>com.google.protobuf.nano:protobuf-javanano</exclude> + <exclude>com.google.protobuf:protobuf-java</exclude> + + <exclude>com.jcraft:jzlib</exclude> + <exclude>com.ning:compress-lzf</exclude> + <exclude>com.yammer.metrics:metrics-core</exclude> + <exclude>commons-logging:commons-logging</exclude> + + <exclude>io.netty:netty-buffer</exclude> + <exclude>io.netty:netty-codec-dns</exclude> + <exclude>io.netty:netty-codec-haproxy</exclude> + <exclude>io.netty:netty-codec-http2</exclude> + <exclude>io.netty:netty-codec-http</exclude> + <exclude>io.netty:netty-codec-memcache</exclude> + <exclude>io.netty:netty-codec-mqtt</exclude> + <exclude>io.netty:netty-codec-redis</exclude> + <exclude>io.netty:netty-codec-socks</exclude> + <exclude>io.netty:netty-codec-stomp</exclude> + <exclude>io.netty:netty-codec</exclude> + <exclude>io.netty:netty-common</exclude> + <exclude>io.netty:netty-example</exclude> + <exclude>io.netty:netty-handler-proxy</exclude> + <exclude>io.netty:netty-handler</exclude> + <exclude>io.netty:netty-resolver-dns</exclude> + <exclude>io.netty:netty-resolver</exclude> + <exclude>io.netty:netty-tcnative</exclude> + <exclude>io.netty:netty-transport-rxtx</exclude> + <exclude>io.netty:netty-transport-sctp</exclude> + <exclude>io.netty:netty-transport-udt</exclude> + <exclude>io.netty:netty-transport</exclude> + + <exclude>log4j:log4j</exclude> + <exclude>net.jpountz.lz4:lz4</exclude> + <exclude>org.apache.logging.log4j:log4j-api</exclude> + <exclude>org.bouncycastle:bcpkix-jdk15on</exclude> + <exclude>org.bouncycastle:bcprov-jdk15on</exclude> + <exclude>org.javassist:javassist</exclude> + <exclude>org.jboss.marshalling:jboss-marshalling</exclude> + <exclude>org.jctools:jctools-core</exclude> + <exclude>org.rxtx:rxtx</exclude> + <exclude>org.slf4j:slf4j-api</exclude> + </excludes> + </artifactSet> + </configuration> + </execution> + </executions> + </plugin> + <!--Now unpack the shaded jar made above so the shaded classes + are available to subsequent modules--> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>${maven-dependency-plugin.version}</version> + <executions> + <execution> + <id>unpack</id> + <phase>package</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + <classifier>sources</classifier> + <type>jar</type> + <overWrite>true</overWrite> + <outputDirectory>${basedir}/src/main/java + </outputDirectory> + <includes>**/*.java</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-netty/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-netty/pom.xml b/ratis-netty/pom.xml index e82550e..eefc433 100644 --- a/ratis-netty/pom.xml +++ b/ratis-netty/pom.xml @@ -33,6 +33,11 @@ <groupId>org.apache.ratis</groupId> <scope>provided</scope> </dependency> + <dependency> + <artifactId>ratis-netty-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + <scope>provided</scope> + </dependency> <dependency> <artifactId>ratis-common</artifactId> @@ -84,11 +89,5 @@ <artifactId>mockito-all</artifactId> <scope>test</scope> </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - <scope>compile</scope> - </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java index 1927951..0c3271c 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyClient.java @@ -17,23 +17,22 @@ */ package org.apache.ratis.netty; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioSocketChannel; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; +import org.apache.ratis.shaded.io.netty.bootstrap.Bootstrap; +import org.apache.ratis.shaded.io.netty.channel.Channel; +import org.apache.ratis.shaded.io.netty.channel.ChannelFuture; +import org.apache.ratis.shaded.io.netty.channel.ChannelInitializer; +import org.apache.ratis.shaded.io.netty.channel.EventLoopGroup; +import org.apache.ratis.shaded.io.netty.channel.socket.SocketChannel; +import org.apache.ratis.shaded.io.netty.channel.socket.nio.NioSocketChannel; +import org.apache.ratis.shaded.io.netty.handler.logging.LogLevel; +import org.apache.ratis.shaded.io.netty.handler.logging.LoggingHandler; +import org.apache.ratis.util.LifeCycle; +import org.apache.ratis.util.NetUtils; import java.io.Closeable; import java.net.InetSocketAddress; import java.util.Objects; -import org.apache.ratis.util.LifeCycle; -import org.apache.ratis.util.NetUtils; - public class NettyClient implements Closeable { private final LifeCycle lifeCycle = new LifeCycle(getClass().getSimpleName()); http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java index 5b7efc8..8b64784 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java @@ -17,16 +17,10 @@ */ package org.apache.ratis.netty; -import static org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerReplyProto.RaftNettyServerReplyCase.EXCEPTIONREPLY; - -import java.io.Closeable; -import java.io.IOException; -import java.util.LinkedList; -import java.util.Queue; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - import org.apache.ratis.protocol.RaftPeer; +import org.apache.ratis.shaded.io.netty.channel.*; +import org.apache.ratis.shaded.io.netty.channel.nio.NioEventLoopGroup; +import org.apache.ratis.shaded.io.netty.channel.socket.SocketChannel; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufDecoder; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufEncoder; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; @@ -38,15 +32,14 @@ import org.apache.ratis.util.PeerProxyMap; import org.apache.ratis.util.ProtoUtils; import org.apache.ratis.util.RaftUtils; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandler; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.SocketChannel; +import java.io.Closeable; +import java.io.IOException; +import java.util.LinkedList; +import java.util.Queue; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +import static org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerReplyProto.RaftNettyServerReplyCase.EXCEPTIONREPLY; public class NettyRpcProxy implements Closeable { public static class PeerMap extends PeerProxyMap<NettyRpcProxy> { http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java ---------------------------------------------------------------------- diff --git a/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java b/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java index dcb70e5..fea39c5 100644 --- a/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java +++ b/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java @@ -17,13 +17,6 @@ */ package org.apache.ratis.netty.server; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.channel.*; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioServerSocketChannel; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; import org.apache.ratis.client.impl.ClientProtoUtils; import org.apache.ratis.netty.NettyConfigKeys; import org.apache.ratis.netty.NettyRpcProxy; @@ -33,10 +26,17 @@ import org.apache.ratis.protocol.RaftPeerId; import org.apache.ratis.rpc.SupportedRpcType; import org.apache.ratis.server.RaftServer; import org.apache.ratis.server.RaftServerRpc; +import org.apache.ratis.shaded.io.netty.bootstrap.ServerBootstrap; +import org.apache.ratis.shaded.io.netty.channel.*; +import org.apache.ratis.shaded.io.netty.channel.nio.NioEventLoopGroup; +import org.apache.ratis.shaded.io.netty.channel.socket.SocketChannel; +import org.apache.ratis.shaded.io.netty.channel.socket.nio.NioServerSocketChannel; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufDecoder; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufEncoder; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; import org.apache.ratis.shaded.io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; +import org.apache.ratis.shaded.io.netty.handler.logging.LogLevel; +import org.apache.ratis.shaded.io.netty.handler.logging.LoggingHandler; import org.apache.ratis.shaded.proto.RaftProtos.*; import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyExceptionReplyProto; import org.apache.ratis.shaded.proto.netty.NettyProtos.RaftNettyServerReplyProto; http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/717e46d4/ratis-proto-shaded/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/pom.xml b/ratis-proto-shaded/pom.xml index 5370837..4241e06 100644 --- a/ratis-proto-shaded/pom.xml +++ b/ratis-proto-shaded/pom.xml @@ -34,8 +34,7 @@ <!--The Default location for sources--> <sources.dir>src/main/java</sources.dir> - <!--Version of protobuf to be shaded --> - <shaded.protobuf.version>3.1.0</shaded.protobuf.version> + <!--Version of grpc to be shaded --> <shaded.grpc.version>1.0.1</shaded.grpc.version> <!--Version of Hadoop to be shaded --> @@ -227,10 +226,6 @@ <pattern>io.grpc</pattern> <shadedPattern>org.apache.ratis.shaded.io.grpc</shadedPattern> </relocation> - <relocation> - <pattern>io.netty.handler.codec.protobuf</pattern> - <shadedPattern>org.apache.ratis.shaded.io.netty.handler.codec.protobuf</shadedPattern> - </relocation> <relocation> <pattern>org.apache.hadoop.ipc.protobuf</pattern> @@ -240,12 +235,6 @@ <filters> <filter> - <artifact>io.netty:netty-codec</artifact> - <includes> - <include>io/netty/handler/codec/protobuf/**</include> - </includes> - </filter> - <filter> <artifact>org.apache.hadoop:hadoop-common</artifact> <includes> <include>org/apache/hadoop/ipc/protobuf/**</include> @@ -255,15 +244,14 @@ <artifactSet> <excludes> - <exclude>asm:asm</exclude> - - <exclude>com.google.code.findbugs</exclude> + <exclude>com.google.code.findbugs:jsr305</exclude> <exclude>com.google.code.gson:gson</exclude> <exclude>com.google.guava:guava</exclude> - com.google.re2j:re2j + <exclude>com.google.re2j:re2j</exclude> <exclude>com.jamesmurty.utils:java-xmlbuilder</exclude> <exclude>com.jcraft:jsch</exclude> + <exclude>com.nimbusds:nimbus-jose-jwt</exclude> <exclude>com.sun.jersey:jersey-core</exclude> <exclude>com.sun.jersey:jersey-json</exclude> @@ -272,7 +260,6 @@ <exclude>com.sun.xml.bind:jaxb-impl</exclude> <exclude>com.thoughtworks.paranamer:paranamer</exclude> - <exclude>commons-beanutils:commons-beanutils-core</exclude> <exclude>commons-beanutils:commons-beanutils</exclude> <exclude>commons-cli:commons-cli</exclude> @@ -280,7 +267,6 @@ <exclude>commons-collections:commons-collections</exclude> <exclude>commons-configuration:commons-configuration</exclude> <exclude>commons-digester:commons-digester</exclude> - <exclude>commons-httpclient:commons-httpclient</exclude> <exclude>commons-io:commons-io</exclude> <exclude>commons-lang:commons-lang</exclude> <exclude>commons-logging:commons-logging</exclude> @@ -289,6 +275,7 @@ <exclude>io.netty:netty-buffer</exclude> <exclude>io.netty:netty-codec-http2</exclude> <exclude>io.netty:netty-codec-http</exclude> + <exclude>io.netty:netty-codec</exclude> <exclude>io.netty:netty-common</exclude> <exclude>io.netty:netty-handler</exclude> <exclude>io.netty:netty-resolver</exclude> @@ -298,13 +285,14 @@ <exclude>javax.activation:activation</exclude> <exclude>javax.servlet.jsp:jsp-api</exclude> <exclude>javax.servlet:servlet-api</exclude> + <exclude>javax.ws.rs:jsr311-api</exclude> <exclude>javax.xml.bind:jaxb-api</exclude> <exclude>javax.xml.stream:stax-api</exclude> - <exclude>javax.servlet:javax.servlet-api</exclude> - <exclude>javax.ws.rs:jsr311-api</exclude> <exclude>log4j:log4j</exclude> <exclude>net.java.dev.jets3t:jets3t</exclude> + <exclude>net.jcip:jcip-annotations</exclude> + <exclude>net.minidev:json-smart</exclude> <exclude>org.apache.avro:avro</exclude> <exclude>org.apache.commons:commons-compress</exclude> @@ -312,15 +300,24 @@ <exclude>org.apache.curator:curator-client</exclude> <exclude>org.apache.curator:curator-framework</exclude> <exclude>org.apache.curator:curator-recipes</exclude> - <exclude>org.apache.directory.api:api-asn1-api</exclude> - <exclude>org.apache.directory.api:api-util</exclude> - <exclude>org.apache.directory.server:apacheds-i18n</exclude> - <exclude>org.apache.directory.server:apacheds-kerberos-codec</exclude> <exclude>org.apache.hadoop:hadoop-annotations</exclude> <exclude>org.apache.hadoop:hadoop-auth</exclude> - <exclude>org.apache.htrace:htrace-core</exclude> + <exclude>org.apache.htrace:htrace-core4</exclude> <exclude>org.apache.httpcomponents:httpclient</exclude> <exclude>org.apache.httpcomponents:httpcore</exclude> + <exclude>org.apache.kerby:kerb-admin</exclude> + <exclude>org.apache.kerby:kerb-client</exclude> + <exclude>org.apache.kerby:kerb-common</exclude> + <exclude>org.apache.kerby:kerb-core</exclude> + <exclude>org.apache.kerby:kerb-crypto</exclude> + <exclude>org.apache.kerby:kerb-identity</exclude> + <exclude>org.apache.kerby:kerb-server</exclude> + <exclude>org.apache.kerby:kerb-simplekdc</exclude> + <exclude>org.apache.kerby:kerb-util</exclude> + <exclude>org.apache.kerby:kerby-asn1</exclude> + <exclude>org.apache.kerby:kerby-config</exclude> + <exclude>org.apache.kerby:kerby-pkix</exclude> + <exclude>org.apache.kerby:kerby-util</exclude> <exclude>org.apache.zookeeper:zookeeper</exclude> <exclude>org.codehaus.jackson:jackson-core-asl</exclude> @@ -329,39 +326,15 @@ <exclude>org.codehaus.jackson:jackson-xc</exclude> <exclude>org.codehaus.jettison:jettison</exclude> + <exclude>org.mortbay.jetty:jetty-sslengine</exclude> <exclude>org.mortbay.jetty:jetty-util</exclude> <exclude>org.mortbay.jetty:jetty</exclude> - <exclude>org.eclipse.jetty:jetty-server</exclude> - <exclude>org.eclipse.jetty:jetty-util</exclude> - <exclude>org.eclipse.jetty:jetty-servlet</exclude> - <exclude>org.eclipse.jetty:jetty-webapp</exclude> - <exclude>org.eclipse.jetty:jetty-util-ajax</exclude> - <exclude>org.mortbay.jetty:jetty-sslengine</exclude> <exclude>org.slf4j:slf4j-api</exclude> <exclude>org.slf4j:slf4j-log4j12</exclude> <exclude>org.tukaani:xz</exclude> <exclude>org.xerial.snappy:snappy-java</exclude> <exclude>xmlenc:xmlenc</exclude> - - <exclude>com.nimbusds:nimbus-jose-jwt</exclude> - <exclude>net.jcip:jcip-annotations</exclude> - <exclude>net.minidev:json-smart</exclude> - - <exclude>org.apache.htrace:htrace-core4</exclude> - <exclude>org.apache.kerby:kerb-simplekdc</exclude> - <exclude>org.apache.kerby:kerby-config</exclude> - <exclude>org.apache.kerby:kerb-core</exclude> - <exclude>org.apache.kerby:kerby-asn1</exclude> - <exclude>org.apache.kerby:kerby-pkix</exclude> - <exclude>org.apache.kerby:kerby-util</exclude> - <exclude>org.apache.kerby:kerb-client</exclude> - <exclude>org.apache.kerby:kerb-common</exclude> - <exclude>org.apache.kerby:kerb-util</exclude> - <exclude>org.apache.kerby:kerb-crypto</exclude> - <exclude>org.apache.kerby:kerb-server</exclude> - <exclude>org.apache.kerby:kerb-identity</exclude> - <exclude>org.apache.kerby:kerb-admin</exclude> </excludes> </artifactSet> </configuration>
