Skip to content

Commit

Permalink
Shade Netty into r2.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpstewart committed May 5, 2022
1 parent 1858813 commit e1e1502
Show file tree
Hide file tree
Showing 105 changed files with 570 additions and 515 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.33.7] - 2022-05-05
- Introduce restli-netty, a shaded Netty dependency for use with r2.

## [29.33.6] - 2022-05-03
- Provide a mechanism to set a routing hint for the d2 request to get request symbol table.

Expand Down Expand Up @@ -5230,7 +5233,8 @@ patch operations can re-use these classes for generating patch messages.

## [0.14.1]

[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.33.6...master
[Unreleased]: https://github.com/linkedin/rest.li/compare/v29.33.7...master
[29.33.7]: https://github.com/linkedin/rest.li/compare/v29.33.6...v29.33.7
[29.33.6]: https://github.com/linkedin/rest.li/compare/v29.33.5...v29.33.6
[29.33.5]: https://github.com/linkedin/rest.li/compare/v29.33.4...v29.33.5
[29.33.4]: https://github.com/linkedin/rest.li/compare/v29.33.3...v29.33.4
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@

buildscript {
repositories {
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0'
classpath 'org.jacoco:org.jacoco.core:0.8.7'
}
Expand Down
12 changes: 9 additions & 3 deletions build_script/publications.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,19 @@ def manipulatePomXml = {
publishing {
publications {
// Define the "release" publication
release(MavenPublication) {
from components.java
release(MavenPublication) { publication ->
if (project.name == 'restli-netty') {
apply plugin: 'com.github.johnrengelman.shadow'
project.shadow.component(publication)
} else {
from components.java
}

afterEvaluate {
// Add all extra archives (sources, javadoc, any custom archives e.g. all)
project.configurations.archives.allArtifacts.forEach {
if (it.classifier) {
// Skip 'slim' identifier, otherwise this logic attemps to publish the disabled slim jar for restli-netty.
if (it.classifier && it.classifier != 'slim') {
artifact it
}
}
Expand Down
1 change: 0 additions & 1 deletion d2-int-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies {
compile externalDependency.commonsHttpClient
compile externalDependency.zookeeper
compile externalDependency.jdkTools
compile externalDependency.netty
testCompile externalDependency.testng
testCompile externalDependency.commonsIo
testCompile project(path: ':d2', configuration: 'testArtifacts')
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=29.33.6
version=29.33.7
group=com.linkedin.pegasus
org.gradle.configureondemand=true
org.gradle.parallel=true
Expand Down
3 changes: 3 additions & 0 deletions multipart-mime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ dependencies {
compile externalDependency.javaxActivation
compile externalDependency.commonsLang
testCompile project(':r2-int-test')
testCompile project(':r2-netty')
testCompile project(':r2-sample')
testCompile project(':test-util')
testCompile externalDependency.testng
testCompile externalDependency.mail
testCompile externalDependency.easymock
Expand Down
1 change: 1 addition & 0 deletions r2-int-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies {
testCompile externalDependency.testng
testCompile externalDependency.junit
compile externalDependency.commonsLang
implementation project(path: ':restli-netty', configuration: 'shadow')
}

tasks.withType(Test) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
import com.linkedin.r2.transport.http.client.common.ChannelPoolManagerFactoryImpl;
import com.linkedin.r2.transport.http.client.common.ChannelPoolManagerKey;
import com.linkedin.r2.transport.http.client.common.ChannelPoolManagerKeyBuilder;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.handler.ssl.SslHandler;
import io.netty.util.concurrent.Future;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.EventLoopGroup;
import com.linkedin.pegasus.io.netty.channel.nio.NioEventLoopGroup;
import com.linkedin.pegasus.io.netty.handler.ssl.SslHandler;
import com.linkedin.pegasus.io.netty.util.concurrent.Future;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.linkedin.r2.transport.common.Client;
import com.linkedin.r2.transport.http.client.HttpClientFactory;
import com.linkedin.r2.util.NamedThreadFactory;
import io.netty.channel.nio.NioEventLoopGroup;
import com.linkedin.pegasus.io.netty.channel.nio.NioEventLoopGroup;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down
2 changes: 1 addition & 1 deletion r2-netty/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ dependencies {
compile project(':r2-core')
compile project(':r2-disruptor')
compile project(':r2-filter-compression')
implementation project(path: ':restli-netty', configuration: 'shadow')

compile externalDependency.commonsLang
compile externalDependency.netty

testCompile project(path: ':r2-core', configuration: 'testArtifacts')
testCompile externalDependency.mockito
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
import com.linkedin.r2.util.Timeout;
import com.linkedin.util.ArgumentUtil;
import com.linkedin.util.clock.Clock;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.pool.ChannelPool;
import io.netty.handler.codec.http.HttpScheme;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelFutureListener;
import com.linkedin.pegasus.io.netty.channel.ChannelPipeline;
import com.linkedin.pegasus.io.netty.channel.EventLoopGroup;
import com.linkedin.pegasus.io.netty.channel.pool.ChannelPool;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpScheme;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import com.linkedin.r2.netty.handler.common.SslHandshakeTimingHandler;
import com.linkedin.r2.netty.handler.http.HttpMessageDecoders;
import com.linkedin.r2.netty.handler.http.HttpMessageEncoders;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.codec.http.HttpScheme;
import com.linkedin.pegasus.io.netty.channel.ChannelInitializer;
import com.linkedin.pegasus.io.netty.channel.socket.nio.NioSocketChannel;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpClientCodec;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpScheme;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLParameters;

Expand All @@ -37,15 +37,15 @@
* the channel pipeline is setup with the following additional handlers.
*
* DefaultChannelPipeline {
* (sslHandler = {@link io.netty.handler.ssl.SslHandler}),
* (sslHandler = {@link com.linkedin.pegasus.io.netty.handler.ssl.SslHandler}),
* (CertificateHandler = {@link CertificateHandler}),
* (sslHandshakeTimingHandler = {@link SslHandshakeTimingHandler})
* }
*
* The rest of the handlers are common between SSL and non-SSL.
*
* DefaultChannelPipeline {
* (codec = {@link io.netty.handler.codec.http.HttpClientCodec}),
* (codec = {@link com.linkedin.pegasus.io.netty.handler.codec.http.HttpClientCodec}),
* (outboundRestRequestEncoder = {@link HttpMessageEncoders.RestRequestEncoder}),
* (outboundStreamDataEncoder = {@link HttpMessageEncoders.DataEncoder}),
* (outboundStreamRequestEncoder = {@link HttpMessageEncoders.StreamRequestEncoder}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
import com.linkedin.r2.transport.http.client.common.ChannelPoolFactory;
import com.linkedin.r2.transport.http.client.common.ChannelPoolLifecycle;
import com.linkedin.util.clock.SystemClock;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import com.linkedin.pegasus.io.netty.bootstrap.Bootstrap;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelInitializer;
import com.linkedin.pegasus.io.netty.channel.ChannelOption;
import com.linkedin.pegasus.io.netty.channel.EventLoopGroup;
import com.linkedin.pegasus.io.netty.channel.group.ChannelGroup;
import com.linkedin.pegasus.io.netty.channel.socket.nio.NioSocketChannel;
import java.net.SocketAddress;
import java.util.concurrent.ScheduledExecutorService;
import javax.net.ssl.SSLContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@
import com.linkedin.r2.netty.handler.http2.Http2MessageEncoders;
import com.linkedin.r2.netty.handler.http2.Http2ProtocolUpgradeHandler;
import com.linkedin.r2.netty.handler.http2.UnsupportedHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPromise;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.HttpClientCodec;
import io.netty.handler.codec.http.HttpClientUpgradeHandler;
import io.netty.handler.codec.http2.Http2ClientUpgradeCodec;
import io.netty.handler.codec.http2.Http2ConnectionHandler;
import io.netty.handler.codec.http2.Http2FrameCodec;
import io.netty.handler.codec.http2.Http2FrameCodecBuilder;
import io.netty.handler.codec.http2.Http2MultiplexHandler;
import io.netty.handler.codec.http2.Http2Settings;
import io.netty.handler.ssl.ApplicationProtocolConfig;
import io.netty.handler.ssl.ApplicationProtocolNames;
import io.netty.handler.ssl.ClientAuth;
import io.netty.handler.ssl.IdentityCipherSuiteFilter;
import io.netty.handler.ssl.JdkSslContext;
import io.netty.handler.ssl.SslContext;
import com.linkedin.pegasus.io.netty.channel.ChannelInitializer;
import com.linkedin.pegasus.io.netty.channel.ChannelPromise;
import com.linkedin.pegasus.io.netty.channel.socket.nio.NioSocketChannel;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpClientCodec;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpClientUpgradeHandler;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2ClientUpgradeCodec;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2ConnectionHandler;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2FrameCodec;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2FrameCodecBuilder;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2MultiplexHandler;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2Settings;
import com.linkedin.pegasus.io.netty.handler.ssl.ApplicationProtocolConfig;
import com.linkedin.pegasus.io.netty.handler.ssl.ApplicationProtocolNames;
import com.linkedin.pegasus.io.netty.handler.ssl.ClientAuth;
import com.linkedin.pegasus.io.netty.handler.ssl.IdentityCipherSuiteFilter;
import com.linkedin.pegasus.io.netty.handler.ssl.JdkSslContext;
import com.linkedin.pegasus.io.netty.handler.ssl.SslContext;

import java.util.Arrays;
import javax.net.ssl.SSLContext;
Expand All @@ -65,7 +65,7 @@
* are added and the pipeline should be setup with the following handlers.
*
* DefaultChannelPipeline {
* (sslHandler = {@link io.netty.handler.ssl.SslHandler}),
* (sslHandler = {@link com.linkedin.pegasus.io.netty.handler.ssl.SslHandler}),
* (CertificateHandler = {@link CertificateHandler}),
* (sslHandshakeTimingHandler = {@link SslHandshakeTimingHandler}),
* (Http2FrameCodec = {@link Http2FrameCodec})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import com.linkedin.r2.transport.http.client.PoolStats;
import com.linkedin.r2.transport.http.client.TimeoutCallback;
import com.linkedin.util.clock.Clock;
import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.handler.codec.http2.Http2StreamChannel;
import io.netty.handler.codec.http2.Http2StreamChannelBootstrap;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.group.ChannelGroup;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2StreamChannel;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2StreamChannelBootstrap;
import java.net.SocketAddress;
import java.util.ArrayDeque;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
import com.linkedin.r2.transport.http.client.common.ChannelPoolFactory;
import com.linkedin.r2.transport.http.client.common.ChannelPoolLifecycle;
import com.linkedin.util.clock.SystemClock;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import com.linkedin.pegasus.io.netty.bootstrap.Bootstrap;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelInitializer;
import com.linkedin.pegasus.io.netty.channel.ChannelOption;
import com.linkedin.pegasus.io.netty.channel.EventLoopGroup;
import com.linkedin.pegasus.io.netty.channel.group.ChannelGroup;
import com.linkedin.pegasus.io.netty.channel.socket.nio.NioSocketChannel;
import java.net.SocketAddress;
import java.util.concurrent.ScheduledExecutorService;
import javax.net.ssl.SSLContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import com.linkedin.r2.netty.handler.common.SchemeHandler;
import com.linkedin.r2.netty.handler.http2.Http2MessageDecoders;
import com.linkedin.r2.netty.handler.http2.Http2MessageEncoders;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import io.netty.handler.codec.http.HttpScheme;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelInitializer;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpScheme;

/**
* Netty handler to setup the Http2 Stream Channel pipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package com.linkedin.r2.netty.common;

import io.netty.channel.Channel;
import io.netty.channel.ChannelPipeline;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelPipeline;

/**
* Enumerates the user events potentially raised in the {@link ChannelPipeline}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import com.linkedin.r2.transport.http.client.AsyncPool;
import com.linkedin.r2.transport.http.client.common.ssl.SslSessionValidator;
import com.linkedin.r2.util.Timeout;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelPipeline;
import io.netty.util.AttributeKey;
import io.netty.util.concurrent.Promise;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelFuture;
import com.linkedin.pegasus.io.netty.channel.ChannelPipeline;
import com.linkedin.pegasus.io.netty.util.AttributeKey;
import com.linkedin.pegasus.io.netty.util.concurrent.Promise;
import java.util.concurrent.ScheduledFuture;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
import com.linkedin.r2.message.stream.StreamRequest;
import com.linkedin.r2.transport.http.common.HttpConstants;
import com.linkedin.r2.transport.http.util.CookieUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.DefaultHttpRequest;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.codec.http2.DefaultHttp2Headers;
import io.netty.handler.codec.http2.Http2Headers;
import io.netty.handler.codec.http2.HttpConversionUtil;
import io.netty.util.AsciiString;
import com.linkedin.pegasus.io.netty.buffer.ByteBuf;
import com.linkedin.pegasus.io.netty.buffer.Unpooled;
import com.linkedin.pegasus.io.netty.handler.codec.http.DefaultFullHttpRequest;
import com.linkedin.pegasus.io.netty.handler.codec.http.DefaultHttpRequest;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpHeaderNames;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpHeaderValues;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpMethod;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpRequest;
import com.linkedin.pegasus.io.netty.handler.codec.http.HttpVersion;
import com.linkedin.pegasus.io.netty.handler.codec.http2.DefaultHttp2Headers;
import com.linkedin.pegasus.io.netty.handler.codec.http2.Http2Headers;
import com.linkedin.pegasus.io.netty.handler.codec.http2.HttpConversionUtil;
import com.linkedin.pegasus.io.netty.util.AsciiString;
import java.net.URI;
import java.net.URL;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.linkedin.r2.netty.common;

import io.netty.handler.ssl.SslHandler;
import com.linkedin.pegasus.io.netty.handler.ssl.SslHandler;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import com.linkedin.util.clock.Clock;
import com.linkedin.util.clock.SystemClock;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import com.linkedin.pegasus.io.netty.channel.Channel;
import com.linkedin.pegasus.io.netty.channel.ChannelHandlerContext;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.linkedin.r2.netty.common.NettyChannelAttributes;
import com.linkedin.r2.netty.common.StreamingTimeout;
import com.linkedin.util.clock.SystemClock;
import io.netty.channel.ChannelHandlerContext;
import com.linkedin.pegasus.io.netty.channel.ChannelHandlerContext;

/**
* Entity stream {@link Reader} implementation that reads from the entity stream
Expand Down
Loading

0 comments on commit e1e1502

Please sign in to comment.