Raise the Netty 5 minimum required Java version to Java 11. (#10650)

Raise the Netty 5 minimum required Java version to Java 11.

Motivation:
Java 11 has been out for some time, and Netty 5 is still some ways out.
There are also many good features in Java 11 that we wish to use, such as VarHandles, var-keyword, and the module system.
There is no reason for Netty 5 to not require Java 11, since Netty 4.x will still be supported for the time being.

Modification:
Remove everything in the pom files related to Java versions older than Java 11.
Remove the animal-sniffer plug-in and rely on the `--release` compiler flag instead.
Remove docker files related to Java versions older than Java 11.
Remove the copied SCTP APIs -- we should test this commit independently on Windows.
Remove the OpenJdkSelfSignedCertGenerator.java file and just always use Bouncy Castle for generating self-signed certificates for testing.
Make netty-testsuite tests pass by including Bouncy Castle as a test dependency, so we're able to generate our self-signed certificate.

Result:
Java 11 is now the minimum required Java version.
This commit is contained in:
Chris Vest 2020-10-12 14:13:01 +02:00 committed by GitHub
parent 2464bee521
commit a179db8066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 50 additions and 911 deletions

View File

@ -704,18 +704,6 @@
</executions>
</plugin>
<!-- Disable animal sniffer -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<executions>
<execution>
<id>default</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- Disable checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>

View File

@ -293,49 +293,6 @@
<maxmem>1024m</maxmem>
</configuration>
</plugin>
<plugin>
<!-- ensure that only methods available in java 1.6 can
be used even when compiling with java 1.7+ -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.15</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java16</artifactId>
<version>1.1</version>
</signature>
<ignores>
<ignore>sun.misc.Unsafe</ignore>
<ignore>sun.misc.Cleaner</ignore>
<ignore>java.util.zip.Deflater</ignore>
<!-- Used for NIO UDP multicast -->
<ignore>java.nio.channels.DatagramChannel</ignore>
<ignore>java.nio.channels.MembershipKey</ignore>
<ignore>java.net.StandardProtocolFamily</ignore>
<!-- Used for NIO. 2 -->
<ignore>java.nio.channels.AsynchronousChannel</ignore>
<ignore>java.nio.channels.AsynchronousSocketChannel</ignore>
<ignore>java.nio.channels.AsynchronousServerSocketChannel</ignore>
<ignore>java.nio.channels.AsynchronousChannelGroup</ignore>
<ignore>java.nio.channels.NetworkChannel</ignore>
<ignore>java.nio.channels.InterruptedByTimeoutException</ignore>
<ignore>java.net.StandardSocketOptions</ignore>
<ignore>java.net.SocketOption</ignore>
</ignores>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.12.1</version>

View File

@ -18,7 +18,7 @@ RUN yum install -y \
tar \
wget
ARG java_version=1.8
ARG java_version=11
ENV JAVA_VERSION $java_version
# installing java with jabba
RUN curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | JABBA_COMMAND="install $JAVA_VERSION -o /jdk" bash

View File

@ -7,7 +7,7 @@ ENV GCC_VERSION $gcc_version
RUN yum install -y wget tar git make redhat-lsb-core autoconf automake libtool glibc-devel libaio-devel openssl-devel apr-devel lksctp-tools
# Install Java
RUN yum install -y java-1.8.0-openjdk-devel
RUN yum install -y java-11-openjdk-devel
# Install aarch64 gcc toolchain
RUN set -x && \
@ -15,4 +15,4 @@ RUN set -x && \
tar xvf gcc-linaro-$GCC_VERSION-x86_64_aarch64-linux-gnu.tar.xz
ENV PATH="/gcc-linaro-$GCC_VERSION-x86_64_aarch64-linux-gnu/bin:${PATH}"
ENV JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk/"
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk/"

View File

@ -4,10 +4,10 @@
cd /path/to/netty/
```
## centos 6 with java 8
## centos 6 with java 11
```
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.18.yaml run test
docker-compose -f docker/docker-compose.yaml -f docker/docker-compose.centos-6.111.yaml run test
```
## centos 7 with java 11

View File

@ -1,21 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.10
build:
args:
centos_version : "6"
java_version : "zulu@1.10.0-2"
test:
image: netty:centos-6-1.10
test-leak:
image: netty:centos-6-1.10
test-boringssl-static:
image: netty:centos-6-1.10
shell:
image: netty:centos-6-1.10

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.8
build:
args:
centos_version : "6"
java_version : "adopt@1.8.0-252"
test:
image: netty:centos-6-1.8
test-leak:
image: netty:centos-6-1.8
test-boringssl-static:
image: netty:centos-6-1.8
shell:
image: netty:centos-6-1.8

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.9
build:
args:
centos_version : "6"
java_version : "zulu@1.9.0-7"
test:
image: netty:centos-6-1.9
test-leak:
image: netty:centos-6-1.9
test-boringssl-static:
image: netty:centos-6-1.9
shell:
image: netty:centos-6-1.9

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-6-1.8
build:
args:
centos_version : "6"
java_version : "graalvm-ce-java8@20.1.0"
test:
image: netty:centos-6-1.8
test-leak:
image: netty:centos-6-1.8
test-boringssl-static:
image: netty:centos-6-1.8
shell:
image: netty:centos-6-1.8

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.10
build:
args:
centos_version : "7"
java_version : "zulu@1.10.0-2"
test:
image: netty:centos-7-1.10
test-leak:
image: netty:centos-7-1.10
test-boringssl-static:
image: netty:centos-7-1.10
shell:
image: netty:centos-7-1.10

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.8
build:
args:
centos_version : "7"
java_version : "adopt@1.8.0-252"
test:
image: netty:centos-7-1.8
test-leak:
image: netty:centos-7-1.8
test-boringssl-static:
image: netty:centos-7-1.8
shell:
image: netty:centos-7-1.8

View File

@ -1,22 +0,0 @@
version: "3"
services:
runtime-setup:
image: netty:centos-7-1.9
build:
args:
centos_version : "7"
java_version : "zulu@1.9.0-7"
test:
image: netty:centos-7-1.9
test-leak:
image: netty:centos-7-1.9
test-boringssl-static:
image: netty:centos-7-1.9
shell:
image: netty:centos-7-1.9

View File

@ -76,6 +76,16 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,84 +0,0 @@
/*
* Copyright 2014 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package io.netty.handler.ssl.util;
import sun.security.x509.AlgorithmId;
import sun.security.x509.CertificateAlgorithmId;
import sun.security.x509.CertificateIssuerName;
import sun.security.x509.CertificateSerialNumber;
import sun.security.x509.CertificateSubjectName;
import sun.security.x509.CertificateValidity;
import sun.security.x509.CertificateVersion;
import sun.security.x509.CertificateX509Key;
import sun.security.x509.X500Name;
import sun.security.x509.X509CertImpl;
import sun.security.x509.X509CertInfo;
import java.util.Date;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import static io.netty.handler.ssl.util.SelfSignedCertificate.*;
/**
* Generates a self-signed certificate using {@code sun.security.x509} package provided by OpenJDK.
*/
final class OpenJdkSelfSignedCertGenerator {
static String[] generate(String fqdn, KeyPair keypair, SecureRandom random, Date notBefore, Date notAfter,
String algorithm) throws Exception {
PrivateKey key = keypair.getPrivate();
// Prepare the information required for generating an X.509 certificate.
X509CertInfo info = new X509CertInfo();
X500Name owner = new X500Name("CN=" + fqdn);
info.set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3));
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(new BigInteger(64, random)));
try {
info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
} catch (CertificateException ignore) {
info.set(X509CertInfo.SUBJECT, owner);
}
try {
info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
} catch (CertificateException ignore) {
info.set(X509CertInfo.ISSUER, owner);
}
info.set(X509CertInfo.VALIDITY, new CertificateValidity(notBefore, notAfter));
info.set(X509CertInfo.KEY, new CertificateX509Key(keypair.getPublic()));
info.set(X509CertInfo.ALGORITHM_ID,
// sha256WithRSAEncryption
new CertificateAlgorithmId(AlgorithmId.get("1.2.840.113549.1.1.11")));
// Sign the cert to identify the algorithm that's used.
X509CertImpl cert = new X509CertImpl(info);
cert.sign(key, algorithm.equalsIgnoreCase("EC") ? "SHA256withECDSA" : "SHA256withRSA");
// Update the algorithm and sign again.
info.set(CertificateAlgorithmId.NAME + '.' + CertificateAlgorithmId.ALGORITHM, cert.get(X509CertImpl.SIG_ALG));
cert = new X509CertImpl(info);
cert.sign(key, algorithm.equalsIgnoreCase("EC") ? "SHA256withECDSA" : "SHA256withRSA");
cert.verify(keypair.getPublic());
return newSelfSignedCertificate(fqdn, key, cert);
}
private OpenJdkSelfSignedCertGenerator() { }
}

View File

@ -21,7 +21,6 @@ import io.netty.buffer.Unpooled;
import io.netty.handler.codec.base64.Base64;
import io.netty.util.CharsetUtil;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.ThrowableUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
@ -53,8 +52,8 @@ import java.util.Date;
* {@link java.io.File#createTempFile(String, String)}, and they are deleted when the JVM exits using
* {@link java.io.File#deleteOnExit()}.
* </p><p>
* At first, this method tries to use OpenJDK's X.509 implementation (the {@code sun.security.x509} package).
* If it fails, it tries to use <a href="http://www.bouncycastle.org/">Bouncy Castle</a> as a fallback.
* The certificate is generated using <a href="http://www.bouncycastle.org/">Bouncy Castle</a>, which is an
* <em>optional</em> dependency of Netty.
* </p>
*/
public final class SelfSignedCertificate {
@ -235,22 +234,13 @@ public final class SelfSignedCertificate {
String[] paths;
try {
// Try the OpenJDK's proprietary implementation.
paths = OpenJdkSelfSignedCertGenerator.generate(fqdn, keypair, random, notBefore, notAfter, algorithm);
} catch (Throwable t) {
logger.debug("Failed to generate a self-signed X.509 certificate using sun.security.x509:", t);
try {
// Try Bouncy Castle if the current JVM didn't have sun.security.x509.
paths = BouncyCastleSelfSignedCertGenerator.generate(
fqdn, keypair, random, notBefore, notAfter, algorithm);
} catch (Throwable t2) {
logger.debug("Failed to generate a self-signed X.509 certificate using Bouncy Castle:", t2);
final CertificateException certificateException = new CertificateException(
"No provider succeeded to generate a self-signed certificate. " +
"See debug log for the root cause.", t2);
ThrowableUtil.addSuppressed(certificateException, t);
throw certificateException;
}
paths = BouncyCastleSelfSignedCertGenerator.generate(
fqdn, keypair, random, notBefore, notAfter, algorithm);
} catch (Throwable throwable) {
logger.debug("Failed to generate a self-signed X.509 certificate using Bouncy Castle:", throwable);
throw new CertificateException(
"No provider succeeded to generate a self-signed certificate. " +
"See debug log for the root cause.", throwable);
}
certificate = new File(paths[0]);

101
pom.xml
View File

@ -199,45 +199,6 @@
</properties>
</profile>
<!-- JDK10 -->
<profile>
<id>java10</id>
<activation>
<jdk>10</jdk>
</activation>
<properties>
<argLine.java9.extras />
<!-- Export some stuff which is used during our tests -->
<argLine.java9>--illegal-access=deny --add-modules java.xml.bind ${argLine.java9.extras}</argLine.java9>
<!-- Not use alpn agent as Java10 supports alpn out of the box -->
<argLine.alpnAgent />
<forbiddenapis.skip>true</forbiddenapis.skip>
<!-- Needed because of https://issues.apache.org/jira/browse/MENFORCER-275 -->
<enforcer.plugin.version>3.0.0-M3</enforcer.plugin.version>
<!-- 1.4.x does not work in Java10+ -->
<jboss.marshalling.version>2.0.5.Final</jboss.marshalling.version>
</properties>
</profile>
<!-- JDK9 -->
<profile>
<id>java9</id>
<properties>
<argLine.java9.extras />
<!-- Export some stuff which is used during our tests -->
<argLine.java9>--illegal-access=deny --add-modules java.xml.bind ${argLine.java9.extras}</argLine.java9>
<!-- Not use alpn agent as Java9 supports alpn out of the box -->
<argLine.alpnAgent />
<!-- Skip as maven plugin not works with Java9 yet -->
<forbiddenapis.skip>true</forbiddenapis.skip>
<!-- Needed because of https://issues.apache.org/jira/browse/MENFORCER-275 -->
<enforcer.plugin.version>3.0.0-M1</enforcer.plugin.version>
</properties>
<activation>
<jdk>9</jdk>
</activation>
</profile>
<profile>
<id>boringssl</id>
<properties>
@ -290,12 +251,12 @@
</build>
</profile>
<profile>
<id>jdk8</id>
<id>relaxjavadoc</id>
<activation>
<jdk>[1.8,)</jdk>
<jdk>[11,)</jdk>
</activation>
<properties>
<!-- Our Javadoc has poor enough quality to fail the build thanks to JDK8 javadoc which got more strict. -->
<!-- Our Javadoc has poor enough quality to fail the build thanks to JDK8+ javadoc which got more strict. -->
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
</properties>
</profile>
@ -319,8 +280,8 @@
</profiles>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<netty.dev.tools.directory>${project.build.directory}/dev-tools</netty.dev.tools.directory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@ -353,6 +314,7 @@
<conscrypt.artifactId>conscrypt-openjdk-uber</conscrypt.artifactId>
<conscrypt.version>2.4.0</conscrypt.version>
<conscrypt.classifier />
<bouncycastle.version>1.66</bouncycastle.version>
<jni.classifier>${os.detected.name}-${os.detected.arch}</jni.classifier>
<logging.config>${project.basedir}/../common/src/test/resources/logback-test.xml</logging.config>
<logging.logLevel>debug</logging.logLevel>
@ -483,14 +445,13 @@
</dependency>
<!--
Bouncy Castle - completely optional, only needed when:
- you generate a temporary self-signed certificate using SelfSignedCertificate, and
- you don't use the JDK which doesn't provide sun.security.x509 package.
Bouncy Castle - completely optional, only needed when you generate a temporary self-signed
certificate using SelfSignedCertificate.
-->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.65</version>
<version>${bouncycastle.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
@ -502,7 +463,7 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.54</version>
<version>${bouncycastle.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
@ -773,9 +734,9 @@
<configuration>
<rules>
<requireJavaVersion>
<!-- Enforce JDK 1.8+ for compilation. -->
<!-- Enforce JDK 11+ for compilation. -->
<!-- This is needed because of java.util.zip.Deflater and NIO UDP multicast. -->
<version>[1.8.0,)</version>
<version>[11.0.0,)</version>
</requireJavaVersion>
<requireMavenVersion>
<version>[3.1.1,)</version>
@ -796,10 +757,11 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<compilerVersion>11</compilerVersion>
<fork>true</fork>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<release>${maven.compiler.target}</release>
<debug>true</debug>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
@ -820,41 +782,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<!-- ensure that only methods available in java 1.6 can
be used even when compiling with java 1.7+ -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.16</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<ignores>
<!--
We need to whitelist MethodHandle as animal-sniffer can not handle it correctly
https://github.com/mojohaus/animal-sniffer/issues/67
-->
<ignore>java.lang.invoke.MethodHandle</ignore>
<ignore>sun.misc.Unsafe</ignore>
<ignore>sun.misc.Cleaner</ignore>
<ignore>sun.nio.ch.DirectBuffer</ignore>
</ignores>
<annotations>
<annotation>io.netty.util.internal.SuppressJava6Requirement</annotation>
</annotations>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>

View File

@ -62,17 +62,6 @@
</executions>
</plugin>
<!-- Disable animal sniffer -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<executions>
<execution>
<id>default</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- Disable checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>

View File

@ -94,6 +94,16 @@
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<properties>

View File

@ -53,8 +53,8 @@
</profiles>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- Needed for SelfSignedCertificate -->
<argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras>
<skipJapicmp>true</skipJapicmp>

View File

@ -1,43 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
@SuppressWarnings("all")
public class AbstractNotificationHandler<T> implements NotificationHandler<T> {
static {
UnsupportedOperatingSystemException.raise();
}
public HandlerResult handleNotification(AssociationChangeNotification notification, Object o) {
return null;
}
public HandlerResult handleNotification(Notification notification, Object o) {
return null;
}
public HandlerResult handleNotification(PeerAddressChangeNotification notification, Object o) {
return null;
}
public HandlerResult handleNotification(SendFailedNotification notification, Object o) {
return null;
}
public HandlerResult handleNotification(ShutdownNotification notification, Object o) {
return null;
}
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public class Association {
static {
UnsupportedOperatingSystemException.raise();
}
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public abstract class AssociationChangeNotification implements Notification {
static {
UnsupportedOperatingSystemException.raise();
}
}

View File

@ -1,20 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public enum HandlerResult {
CONTINUE, RETURN
}

View File

@ -1,38 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
import java.net.SocketAddress;
public abstract class MessageInfo {
static {
UnsupportedOperatingSystemException.raise();
}
public static MessageInfo createOutgoing(Association association, SocketAddress address, int streamNumber) {
return null;
}
public abstract SocketAddress address();
public abstract int streamNumber();
public abstract MessageInfo streamNumber(int streamNumber);
public abstract int payloadProtocolID();
public abstract MessageInfo payloadProtocolID(int ppid);
public abstract boolean isComplete();
public abstract boolean isUnordered();
public abstract MessageInfo unordered(boolean b);
}

View File

@ -1,20 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public interface Notification {
Association association();
}

View File

@ -1,19 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public interface NotificationHandler<T> {
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public abstract class PeerAddressChangeNotification implements Notification {
static {
UnsupportedOperatingSystemException.raise();
}
}

View File

@ -1,58 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.SelectorProvider;
import java.util.Set;
@SuppressWarnings("all")
public abstract class SctpChannel extends AbstractSelectableChannel {
static {
UnsupportedOperatingSystemException.raise();
}
public static SctpChannel open() throws IOException {
return null;
}
protected SctpChannel(SelectorProvider provider) {
super(provider);
}
public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
public abstract <T> SctpChannel setOption(SctpSocketOption<T> name, T value) throws IOException;
public abstract Set<SocketAddress> getAllLocalAddresses() throws IOException;
public abstract Set<SocketAddress> getRemoteAddresses() throws IOException;
public abstract Association association() throws IOException;
public abstract SctpChannel bind(SocketAddress local) throws IOException;
public abstract boolean connect(SocketAddress remote) throws IOException;
public abstract boolean finishConnect() throws IOException;
public abstract SctpChannel bindAddress(InetAddress inetAddress) throws IOException;
public abstract SctpChannel unbindAddress(InetAddress inetAddress) throws IOException;
public abstract <T> MessageInfo receive(ByteBuffer dst, T attachment, NotificationHandler<T> handler) throws IOException;
public abstract int send(ByteBuffer src, MessageInfo messageInfo) throws IOException;
public abstract Set<SctpSocketOption<?>> supportedOptions();
}

View File

@ -1,51 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.nio.channels.spi.AbstractSelectableChannel;
import java.nio.channels.spi.SelectorProvider;
import java.util.Set;
@SuppressWarnings("all")
public abstract class SctpServerChannel extends AbstractSelectableChannel {
static {
UnsupportedOperatingSystemException.raise();
}
public static SctpServerChannel open() throws IOException {
return null;
}
protected SctpServerChannel(SelectorProvider provider) {
super(provider);
}
public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name, T value) throws IOException;
public abstract Set<SocketAddress> getAllLocalAddresses() throws IOException;
public abstract SctpServerChannel bind(SocketAddress local) throws IOException;
public abstract SctpServerChannel bind(SocketAddress local, int backlog) throws IOException;
public abstract SctpServerChannel bindAddress(InetAddress inetAddress) throws IOException;
public abstract SctpServerChannel unbindAddress(InetAddress inetAddress) throws IOException;
public abstract SctpChannel accept() throws IOException;
}

View File

@ -1,21 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public interface SctpSocketOption<T> {
String name();
Class<T> type();
}

View File

@ -1,52 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
import java.net.SocketAddress;
@SuppressWarnings("all")
public class SctpStandardSocketOptions {
static {
UnsupportedOperatingSystemException.raise();
}
public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = null;
public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = null;
public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE = null;
public static final SctpSocketOption<InitMaxStreams> SCTP_INIT_MAXSTREAMS = null;
public static final SctpSocketOption<Boolean> SCTP_NODELAY = null;
public static final SctpSocketOption<SocketAddress> SCTP_PRIMARY_ADDR = null;
public static final SctpSocketOption<SocketAddress> SCTP_SET_PEER_PRIMARY_ADDR = null;
public static final SctpSocketOption<Integer> SO_LINGER = null;
public static final SctpSocketOption<Integer> SO_RCVBUF = null;
public static final SctpSocketOption<Integer> SO_SNDBUF = null;
public static class InitMaxStreams {
public static InitMaxStreams create(int i, int i1) {
return null;
}
public int maxInStreams() {
return 0;
}
public int maxOutStreams() {
return 0;
}
}
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public abstract class SendFailedNotification implements Notification {
static {
UnsupportedOperatingSystemException.raise();
}
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public abstract class ShutdownNotification implements Notification {
static {
UnsupportedOperatingSystemException.raise();
}
}

View File

@ -1,40 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
package com.sun.nio.sctp;
public class UnsupportedOperatingSystemException extends RuntimeException {
private static final long serialVersionUID = -221782446524784377L;
public static void raise() {
throw new UnsupportedOperatingSystemException();
}
public UnsupportedOperatingSystemException() {
}
public UnsupportedOperatingSystemException(String message) {
super(message);
}
public UnsupportedOperatingSystemException(String message, Throwable cause) {
super(message, cause);
}
public UnsupportedOperatingSystemException(Throwable cause) {
super(cause);
}
}

View File

@ -1,22 +0,0 @@
/*
* Copyright 2011 The Netty Project
*
* The Netty Project licenses this file to you 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.
*/
/**
* This package is only included to let SCTP also compile on non-unix operation systems.
*
* <strong>This will not get included in the generated jar!</strong>
*/
package com.sun.nio.sctp;

View File

@ -27,7 +27,6 @@ import com.sun.nio.sctp.ShutdownNotification;
import io.netty.channel.ChannelPipeline;
/**
* {@link AbstractNotificationHandler} implementation which will handle all {@link Notification}s by trigger a
* {@link Notification} user event in the {@link ChannelPipeline} of a {@link SctpChannel}.