use Jetty ALPN agent instead of Jetty ALPN

#1497
This commit is contained in:
ZHANG Dapeng 2016-05-02 14:01:36 -07:00
parent cd8f82871f
commit aed886d8de
5 changed files with 19 additions and 21 deletions

View File

@ -217,13 +217,17 @@ dependencies {
If not using the Netty transport (or you are unable to use OpenSSL for some reason) another alternative is to use the JDK for TLS.
No standard Java release has built-in support for ALPN today ([there is a tracking issue](https://bugs.openjdk.java.net/browse/JDK-8051498) so go upvote it!) so we need to use the [Jetty-ALPN](https://github.com/jetty-project/jetty-alpn") (or [Jetty-NPN](https://github.com/jetty-project/jetty-npn) if on Java < 8) bootclasspath extension for OpenJDK. To do this, add a `Xbootclasspath` JVM option referencing the path to the Jetty `alpn-boot` jar.
No standard Java release has built-in support for ALPN today ([there is a tracking issue](https://bugs.openjdk.java.net/browse/JDK-8051498) so go upvote it!) so we need to use the [Jetty-ALPN](https://github.com/jetty-project/jetty-alpn) (or [Jetty-NPN](https://github.com/jetty-project/jetty-npn) if on Java < 8) bootclasspath extension for OpenJDK. To do this, add an `Xbootclasspath` JVM option referencing the path to the Jetty `alpn-boot` jar.
```sh
java -Xbootclasspath/p:/path/to/jetty/alpn/extension.jar ...
```
Note that you must use the [release of the Jetty-ALPN jar](http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-versions) specific to the version of Java you are using.
Note that you must use the [release of the Jetty-ALPN jar](http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-versions) specific to the version of Java you are using. However, you can use the JVM agent [Jeety-ALPN-Agent](https://github.com/jetty-project/jetty-alpn-agent) to load the correct Jetty `alpn-boot` jar file for the current Java version. To do this, instead of adding an `Xbootclasspath` option, add a `javaagent` JVM option referencing the path to the Jetty `alpn-agent` jar.
```sh
java -javaagent:/path/to/jetty-alpn-agent.jar ...
```
### JDK Ciphers

View File

@ -56,7 +56,7 @@ def vmArgs = [
task qps_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.AsyncClient"
applicationName = "qps_client"
defaultJvmOpts = ["-Xbootclasspath/p:" + configurations.alpnboot.asPath] + vmArgs
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
@ -64,7 +64,7 @@ task qps_client(type: CreateStartScripts) {
task openloop_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.OpenLoopClient"
applicationName = "openloop_client"
defaultJvmOpts = ["-Xbootclasspath/p:" + configurations.alpnboot.asPath] + vmArgs
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
@ -72,7 +72,7 @@ task openloop_client(type: CreateStartScripts) {
task qps_server(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.AsyncServer"
applicationName = "qps_server"
defaultJvmOpts = ["-Xbootclasspath/p:" + configurations.alpnboot.asPath] + vmArgs
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
@ -80,7 +80,7 @@ task qps_server(type: CreateStartScripts) {
task benchmark_worker(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.driver.LoadWorker"
applicationName = "benchmark_worker"
defaultJvmOpts = ["-Xbootclasspath/p:" + configurations.alpnboot.asPath] + vmArgs
defaultJvmOpts = ["-javaagent:" + configurations.alpnagent.asPath] + vmArgs
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}

View File

@ -149,21 +149,15 @@ subprojects {
// Benchmark dependencies
hdrhistogram: 'org.hdrhistogram:HdrHistogram:2.1.8',
math: 'org.apache.commons:commons-math3:3.6',
// Jetty ALPN dependencies
jetty_alpn_agent: 'org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.2'
]
// Determine the correct version of Jetty ALPN boot to use based
// on the Java version.
def alpnboot_version = '8.1.2.v20141202'
if (JavaVersion.current().ordinal() < JavaVersion.VERSION_1_8.ordinal()) {
alpnboot_version = '7.1.3.v20150130'
}
alpnboot_package_name = 'org.mortbay.jetty.alpn:alpn-boot:' + alpnboot_version
}
// Define a separate configuration for managing the dependency on Jetty alpnboot jar.
// Define a separate configuration for managing the dependency on Jetty ALPN agent.
configurations {
alpnboot
alpnagent
tcnative
}
@ -171,8 +165,8 @@ subprojects {
testCompile libraries.junit,
libraries.mockito
// Configuration for modules that use Jetty ALPN
alpnboot alpnboot_package_name
// Configuration for modules that use Jetty ALPN agent
alpnagent libraries.jetty_alpn_agent
// Configuration for modules that use Netty tcnative (for OpenSSL).
tcnative libraries.netty_tcnative

View File

@ -29,7 +29,7 @@ dependencies {
test {
// For the automated tests, use Jetty ALPN.
jvmArgs "-Xbootclasspath/p:" + configurations.alpnboot.asPath
jvmArgs "-javaagent:" + configurations.alpnagent.asPath
}
// The application plugin uses the distribution plugin and configures the jars to be

View File

@ -9,7 +9,7 @@ dependencies {
}
test {
jvmArgs "-Xbootclasspath/p:" + configurations.alpnboot.asPath
jvmArgs "-javaagent:" + configurations.alpnagent.asPath
}
javadoc.options.links 'http://netty.io/4.1/api/'