Remove JDK 8 related maven configuration
Signed-off-by: jansupol <jan.supol@oracle.com>
diff --git a/connectors/jdk-connector/pom.xml b/connectors/jdk-connector/pom.xml
index 15b8cdc..ffa5100 100644
--- a/connectors/jdk-connector/pom.xml
+++ b/connectors/jdk-connector/pom.xml
@@ -34,6 +34,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
+ <surefire.security.argline>-Djdk.tls.server.protocols=TLSv1.2</surefire.security.argline>
</properties>
<dependencies>
@@ -78,16 +80,6 @@
<profiles>
<profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <properties>
- <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
- <surefire.security.argline>-Djdk.tls.server.protocols=TLSv1.2</surefire.security.argline>
- </properties>
- </profile>
- <profile>
<id>disable_tls1and11</id>
<!-- TLS 1 and TLS 1.1 are disabled for JDK 16 -->
<activation>
@@ -110,5 +102,4 @@
</build>
</profile>
</profiles>
-
</project>
diff --git a/connectors/jetty-connector/pom.xml b/connectors/jetty-connector/pom.xml
index 90761ac..6b1fe22 100644
--- a/connectors/jetty-connector/pom.xml
+++ b/connectors/jetty-connector/pom.xml
@@ -34,10 +34,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <java8.build.outputDirectory>${project.basedir}/target</java8.build.outputDirectory>
- <java8.sourceDirectory>${project.basedir}/src/main/java8</java8.sourceDirectory>
- <java11.build.outputDirectory>${project.basedir}/target11</java11.build.outputDirectory>
- <java11.sourceDirectory>${project.basedir}/src/main/java11</java11.sourceDirectory>
</properties>
<dependencies>
@@ -62,12 +58,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
-<!-- <dependency>-->
-<!-- <groupId>org.glassfish.jersey.media</groupId>-->
-<!-- <artifactId>jersey-media-json-jackson</artifactId>-->
-<!-- <version>${project.version}</version>-->
-<!-- <scope>test</scope>-->
-<!-- </dependency>-->
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jetty</artifactId>
@@ -84,6 +80,11 @@
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-osgi</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -102,174 +103,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
- <plugin>
- <!-- TODO remove after jakartification -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>default-test</id> <!-- jakartification-excluded-tests -->
- <configuration>
- <excludes>
- <exclude>org/glassfish/jersey/jetty/connector/EntityTest.java</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
-
- <profiles>
- <profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <properties>
- <jetty.version>9.4.28.v20200408</jetty.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-client</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- </dependencies>
- <build>
- <directory>${java8.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java8.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/jetty/connector/*.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>Jetty11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <build>
- <directory>${java11.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java11.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyJDK11FilesToMultiReleaseJar</id>
- <activation>
- <file>
- <!-- ${java11.build.outputDirectory} does not work here -->
- <exists>target11/classes/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.class</exists>
- </file>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <inherited>true</inherited>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Multi-Release>true</Multi-Release>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>copy-jdk11-classes</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${java8.build.outputDirectory}/classes/META-INF/versions/11</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.build.outputDirectory}/classes</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-jdk11-sources</id>
- <phase>package</phase>
- <configuration>
- <target>
- <property name="sources-jar" value="${java8.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
- <echo>sources-jar: ${sources-jar}</echo>
- <zip destfile="${sources-jar}" update="true">
- <zipfileset dir="${java11.sourceDirectory}" prefix="META-INF/versions/11"/>
- </zip>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>
diff --git a/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnector.java b/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnector.java
similarity index 100%
rename from connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnector.java
rename to connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnector.java
diff --git a/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java b/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
similarity index 98%
rename from connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
rename to connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
index 44146c8..933ad39 100644
--- a/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
+++ b/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
diff --git a/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java b/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java
similarity index 100%
rename from connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java
rename to connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java
diff --git a/connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java b/connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java
similarity index 100%
rename from connectors/jetty-connector/src/main/java11/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java
rename to connectors/jetty-connector/src/main/java/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java
diff --git a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java b/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
deleted file mode 100644
index 8723025..0000000
--- a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyConnectorProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.jetty.connector;
-
-import jakarta.ws.rs.ProcessingException;
-import jakarta.ws.rs.client.Client;
-import jakarta.ws.rs.core.Configuration;
-
-import org.glassfish.jersey.client.spi.Connector;
-import org.glassfish.jersey.client.spi.ConnectorProvider;
-
-import org.glassfish.jersey.internal.util.JdkVersion;
-
-/**
- * JDK 1.8 Jetty Connector stub which only throws exception when running on JDK 1.8
- * New Jetty (11+) does not support JDKs prior to 11
- *
- * @since 3.0.0
- */
-public class JettyConnectorProvider implements ConnectorProvider {
-
- @Override
- public Connector getConnector(Client client, Configuration runtimeConfig) {
- if (JdkVersion.getJdkVersion().getMajor() < 11) {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
- return null; // does not work at JDK 1.8
- }
-
-}
diff --git a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java b/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java
deleted file mode 100644
index b061ef5..0000000
--- a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyHttpClientContract.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.jetty.connector;
-
-import org.eclipse.jetty.client.HttpClient;
-import org.glassfish.jersey.spi.Contract;
-
-/**
- * A contract that allows for an optional registration of user predefined Jetty {@code HttpClient}
- * that is consequently used by {@link JettyConnector}
- */
-@Contract
-public interface JettyHttpClientContract {
- /**
- * Supply a user predefined HttpClient
- * @return a user predefined HttpClient
- */
- HttpClient getHttpClient();
-}
diff --git a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java b/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java
deleted file mode 100644
index 59c8fd3..0000000
--- a/connectors/jetty-connector/src/main/java8/org/glassfish/jersey/jetty/connector/JettyHttpClientSupplier.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-package org.glassfish.jersey.jetty.connector;
-
-import jakarta.ws.rs.ProcessingException;
-import org.eclipse.jetty.client.HttpClient;
-import org.glassfish.jersey.internal.util.JdkVersion;
-
-/**
- * Jetty HttpClient supplier to be registered into Jersey configuration to be used by {@link JettyConnector}.
- * Not every possible configuration option is covered by the Jetty Connector and this supplier offers a way to provide
- * an HttpClient that has configured the options not covered by the Jetty Connector.
- * <p>
- * Typical usage:
- * </p>
- * <pre>
- * {@code
- * HttpClient httpClient = ...
- *
- * ClientConfig config = new ClientConfig();
- * config.connectorProvider(new JettyConnectorProvider());
- * config.register(new JettyHttpClientSupplier(httpClient));
- * Client client = ClientBuilder.newClient(config);
- * }
- * </pre>
- * <p>
- * The {@code HttpClient} is configured as if it was created by {@link JettyConnector} the usual way.
- * </p>
- */
-public class JettyHttpClientSupplier implements JettyHttpClientContract {
- private final HttpClient httpClient;
-
- /**
- * {@code HttpClient} supplier to be optionally registered to a {@link org.glassfish.jersey.client.ClientConfig}
- * @param httpClient a HttpClient to be supplied when {@link JettyConnector#getHttpClient()} is called.
- */
- public JettyHttpClientSupplier(HttpClient httpClient) {
- this.httpClient = httpClient;
- }
-
- @Override
- public HttpClient getHttpClient() {
- if (JdkVersion.getJdkVersion().getMajor() < 11) {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
- return null; // does not work at JDK 1.8
- }
-}
diff --git a/containers/jdk-http/pom.xml b/containers/jdk-http/pom.xml
index f4e2203..59bb242 100644
--- a/containers/jdk-http/pom.xml
+++ b/containers/jdk-http/pom.xml
@@ -79,45 +79,8 @@
</resources>
</build>
- <profiles>
- <profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <properties>
- <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
- <surefire.security.argline>-Djdk.tls.client.protocols=TLSv1.2</surefire.security.argline>
- </properties>
- </profile>
- <profile>
- <id>windows</id>
- <activation>
- <jdk>1.8</jdk>
- <os>
- <family>windows</family>
- </os>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- Exclude unit tests regarding JDK HTTP Server because of failing a server shutdown in a class
- with several tests. "java.net.BindException: Address already in use: bind"
- bug reported on https://bugs.openjdk.java.net/browse/JDK-8015692 -->
- <excludes>
- <exclude>org/glassfish/jersey/jdkhttp/BasicJdkHttpServerTest.java</exclude>
- <exclude>org/glassfish/jersey/jdkhttp/JdkHttpPackageTest.java</exclude>
- <exclude>org/glassfish/jersey/jdkhttp/JdkHttpsServerTest.java</exclude>
- <exclude>org/glassfish/jersey/jdkhttp/LifecycleListenerTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
+ <properties>
+ <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
+ <surefire.security.argline>-Djdk.tls.client.protocols=TLSv1.2</surefire.security.argline>
+ </properties>
</project>
diff --git a/containers/jetty-http/pom.xml b/containers/jetty-http/pom.xml
index dfb7465..d5bb14b 100644
--- a/containers/jetty-http/pom.xml
+++ b/containers/jetty-http/pom.xml
@@ -96,162 +96,4 @@
</resources>
</build>
- <properties>
- <java8.build.outputDirectory>${project.basedir}/target</java8.build.outputDirectory>
- <java8.sourceDirectory>${project.basedir}/src/main/java8</java8.sourceDirectory>
- <java11.build.outputDirectory>${project.basedir}/target11</java11.build.outputDirectory>
- <java11.sourceDirectory>${project.basedir}/src/main/java11</java11.sourceDirectory>
- </properties>
-
- <profiles>
- <profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <properties>
- <jetty.version>9.4.28.v20200408</jetty.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-client</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- </dependencies>
- <build>
- <directory>${java8.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java8.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/jetty/*.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>Jetty11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <build>
- <directory>${java11.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java11.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyJDK11FilesToMultiReleaseJar</id>
- <activation>
- <file>
- <!-- ${java11.build.outputDirectory} does not work here -->
- <exists>target11/classes/org/glassfish/jersey/jetty/JettyHttpContainer.class</exists>
- </file>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <inherited>true</inherited>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Multi-Release>true</Multi-Release>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>copy-jdk11-classes</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${java8.build.outputDirectory}/classes/META-INF/versions/11</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.build.outputDirectory}/classes</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-jdk11-sources</id>
- <phase>package</phase>
- <configuration>
- <target>
- <property name="sources-jar" value="${java8.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
- <echo>sources-jar: ${sources-jar}</echo>
- <zip destfile="${sources-jar}" update="true">
- <zipfileset dir="${java11.sourceDirectory}" prefix="META-INF/versions/11"/>
- </zip>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
diff --git a/containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainer.java b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainer.java
similarity index 100%
rename from containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainer.java
rename to containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainer.java
diff --git a/containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
similarity index 99%
rename from containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
rename to containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
index 39f23e8..3ccb7b8 100644
--- a/containers/jetty-http/src/main/java11/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
+++ b/containers/jetty-http/src/main/java/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
diff --git a/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java b/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java
deleted file mode 100644
index b852e54..0000000
--- a/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.jetty;
-
-import jakarta.ws.rs.ProcessingException;
-import jakarta.ws.rs.core.Application;
-import org.glassfish.jersey.jetty.internal.LocalizationMessages;
-import org.glassfish.jersey.server.ApplicationHandler;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.server.spi.Container;
-
-/**
- * Jersey {@code Container} stub based on Jetty {@link org.eclipse.jetty.server.Handler}.
- *
- * For JDK 1.8 only since Jetty 11 does not support JDKs below 11
- *
- */
-public final class JettyHttpContainer implements Container {
-
- public JettyHttpContainer(Application application) {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- @Override
- public ResourceConfig getConfiguration() {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- @Override
- public ApplicationHandler getApplicationHandler() {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- @Override
- public void reload() {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- @Override
- public void reload(ResourceConfig configuration) {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
-}
diff --git a/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java b/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
deleted file mode 100644
index 1218c2e..0000000
--- a/containers/jetty-http/src/main/java8/org/glassfish/jersey/jetty/JettyHttpContainerFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.jetty;
-
-import jakarta.ws.rs.ProcessingException;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.glassfish.jersey.internal.util.JdkVersion;
-import org.glassfish.jersey.jetty.internal.LocalizationMessages;
-import org.glassfish.jersey.server.ResourceConfig;
-
-import java.net.URI;
-
-/**
- * Jersey {@code Container} stub.
- *
- * For JDK 1.8 only since Jetty 11 does not support JDKs below 11
- *
- */
-public final class JettyHttpContainerFactory {
-
- private JettyHttpContainerFactory() {
- }
-
- public static Server createServer(final URI uri) throws ProcessingException {
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- public static Server createServer(final URI uri, final boolean start) throws ProcessingException {
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- public static Server createServer(final URI uri, final ResourceConfig config)
- throws ProcessingException {
-
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- public static Server createServer(final URI uri, final ResourceConfig configuration, final boolean start)
- throws ProcessingException {
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- public static Server createServer(final URI uri, final ResourceConfig config, final boolean start,
- final Object parentContext) {
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- public static Server createServer(final URI uri, final ResourceConfig config, final Object parentContext) {
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- public static Server createServer(final URI uri, final SslContextFactory.Server sslContextFactory,
- final ResourceConfig config)
- throws ProcessingException {
- validateJdk();
- return null; // does not work at JDK 1.8 }
- }
-
- public static Server createServer(final URI uri,
- final SslContextFactory.Server sslContextFactory,
- final JettyHttpContainer handler,
- final boolean start) {
- validateJdk();
- return null; // does not work at JDK 1.8
- }
-
- private static void validateJdk() {
- if (JdkVersion.getJdkVersion().getMajor() < 11) {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
- }
-}
diff --git a/containers/jetty-servlet/pom.xml b/containers/jetty-servlet/pom.xml
index 7f483ec..97bf69c 100644
--- a/containers/jetty-servlet/pom.xml
+++ b/containers/jetty-servlet/pom.xml
@@ -48,6 +48,15 @@
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet5.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-jetty-http</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
@@ -75,190 +84,4 @@
</plugins>
</build>
- <properties>
- <java8.build.outputDirectory>${project.basedir}/target</java8.build.outputDirectory>
- <java8.sourceDirectory>${project.basedir}/src/main/java8</java8.sourceDirectory>
- <java11.build.outputDirectory>${project.basedir}/target11</java11.build.outputDirectory>
- <java11.sourceDirectory>${project.basedir}/src/main/java11</java11.sourceDirectory>
- <jetty.javax.version>9.4.28.v20200408</jetty.javax.version>
- </properties>
-
- <profiles>
- <profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty.javax.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty.javax.version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-jetty-http</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- <build>
- <directory>${java8.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java8.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/jetty/*.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>Jetty11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>jersey-container-jetty-http</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <build>
- <directory>${java11.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java11.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyJDK11FilesToMultiReleaseJar</id>
- <activation>
- <file>
- <!-- ${java11.build.outputDirectory} does not work here -->
- <exists>target11/classes/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.class</exists>
- </file>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <inherited>true</inherited>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Multi-Release>true</Multi-Release>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>copy-jdk11-classes</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${java8.build.outputDirectory}/classes/META-INF/versions/11</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.build.outputDirectory}/classes</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-jdk11-sources</id>
- <phase>package</phase>
- <configuration>
- <target>
- <property name="sources-jar" value="${java8.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
- <echo>sources-jar: ${sources-jar}</echo>
- <zip destfile="${sources-jar}" update="true">
- <zipfileset dir="${java11.sourceDirectory}" prefix="META-INF/versions/11"/>
- </zip>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
diff --git a/containers/jetty-servlet/src/main/java11/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java b/containers/jetty-servlet/src/main/java/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
similarity index 99%
rename from containers/jetty-servlet/src/main/java11/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
rename to containers/jetty-servlet/src/main/java/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
index 7f46e7b..a663a50 100644
--- a/containers/jetty-servlet/src/main/java11/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
+++ b/containers/jetty-servlet/src/main/java/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
diff --git a/containers/jetty-servlet/src/main/java8/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java b/containers/jetty-servlet/src/main/java8/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
deleted file mode 100644
index 3d87ae8..0000000
--- a/containers/jetty-servlet/src/main/java8/org/glassfish/jersey/jetty/servlet/JettyWebContainerFactory.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.jetty.servlet;
-
-import java.net.URI;
-import java.util.Map;
-
-import jakarta.servlet.Servlet;
-
-import jakarta.ws.rs.ProcessingException;
-import org.eclipse.jetty.server.Server;
-import org.glassfish.jersey.jetty.internal.LocalizationMessages;
-
-/**
- * Jersey {@code Server} stub based on Jetty {@link org.eclipse.jetty.server.Server}.
- * <p>
- * For JDK 1.8 only since Jetty 11 does not support JDKs below 11
- */
-public final class JettyWebContainerFactory {
-
- private JettyWebContainerFactory() {
- }
-
-
- public static Server create(String u)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(String u, Map<String, String> initParams)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(URI u)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(URI u, Map<String, String> initParams)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(String u, Class<? extends Servlet> c)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(String u, Class<? extends Servlet> c,
- Map<String, String> initParams)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(URI u, Class<? extends Servlet> c)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(URI u, Class<? extends Servlet> c, Map<String, String> initParams)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- private static Server create(URI u, Class<? extends Servlet> c, Servlet servlet,
- Map<String, String> initParams, Map<String, String> contextInitParams)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-
- public static Server create(URI u, Servlet servlet, Map<String, String> initParams, Map<String, String> contextInitParams)
- throws Exception {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-}
\ No newline at end of file
diff --git a/core-common/pom.xml b/core-common/pom.xml
index 44a3801..1e8ec8b 100644
--- a/core-common/pom.xml
+++ b/core-common/pom.xml
@@ -230,446 +230,6 @@
<profiles>
<profile>
- <id>jdk8</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/main/jsr166</source>
- <source>src/main/java8</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.8.0</version>
- <scope>system</scope>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <echo>Building for JDK8</echo>
- </target>
- </configuration>
- </execution>
- <execution>
- <!-- need to compile this to be able to compile-2-java8 -->
- <id>compile-1-jsr166</id>
- <phase>process-resources</phase>
- <configuration>
- <target>
- <javac srcdir="${jsr166.sourceDirectory}" destdir="${project.build.outputDirectory}"
- classpath="${project.build.outputDirectory}" includeantruntime="false" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <!-- Compile these files with jdk 8 and put them aside to be included in multirelase jar -->
- <!-- Multi-release jar is built by jdk 11+, but these classes are buildable by jdk 8 only -->
- <id>compile-2-java8</id>
- <phase>process-resources</phase>
- <configuration>
- <target>
- <mkdir dir="${java8.build.outputDirectory}" />
- <javac srcdir="${java8.sourceDirectory}" destdir="${java8.build.outputDirectory}"
- classpath="${project.build.outputDirectory}" includeantruntime="false" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <echo>Building for JDK 11+</echo>
- </target>
- </configuration>
- </execution>
- <execution>
- <id>compile-1-jsr166</id>
- <phase>process-resources</phase>
- <configuration>
- <target>
- <javac srcdir="${jsr166.sourceDirectory}" destdir="${project.build.outputDirectory}"
- classpath="${project.build.outputDirectory}" includeantruntime="false" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <!-- build these java 11 specific classes to be put to META-INF/versions/11 later -->
- <id>compile-2-java11</id>
- <phase>process-resources</phase>
- <configuration>
- <target>
- <mkdir dir="${java11.build.outputDirectory}" />
- <javac srcdir="${java11.sourceDirectory}" destdir="${java11.build.outputDirectory}"
- classpath="${project.build.outputDirectory}" includeantruntime="false" release="11" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>compile-0-addsources</id>
- <phase>process-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/main/jsr166</source>
- <source>src/main/java11</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <execution>
- <id>default-compile</id>
- <configuration>
- <!-- compile everything to ensure module-info contains right entries -->
- <release>11</release>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyJDK11FilesToMultiReleaseJar</id>
- <activation>
- <file>
- <!-- ${java11.build.outputDirectory} does not work here -->
- <exists>target/classes-java11/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.class</exists>
- </file>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <inherited>true</inherited>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Multi-Release>true</Multi-Release>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <!-- only one file set per execution works -->
- <executions>
- <execution>
- <id>remove-jdk11-generated-sources</id>
- <phase>initialize</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>${project.build.directory}/generated-sources</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- <execution>
- <id>remove-jdk11-classes</id>
- <phase>initialize</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>${project.build.directory}/classes</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>copy-jdk11-sources</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/generated-sources/rsrc-gen/META-INF/versions/11/org/glassfish/jersey/internal/jsr166</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.sourceDirectory}/org/glassfish/jersey/internal/jsr166</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-jdk11-classes-to-meta-inf</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.outputDirectory}/META-INF/versions/11</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.build.outputDirectory}</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyJDK8FilesToMultiReleaseJar</id>
- <activation>
- <file>
- <!-- ${java8.build.outputDirectory} does not work here -->
- <exists>target/classes-java8/org/glassfish/jersey/internal/jsr166/UnsafeAccessor.class</exists>
- </file>
- <jdk>[11,)</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <inherited>true</inherited>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Multi-Release>true</Multi-Release>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <!-- only one file set per execution works -->
- <executions>
- <execution>
- <id>remove-jdk11-jsr166-sources</id>
- <phase>initialize</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>${project.build.directory}/generated-sources/rsrc-gen/org/glassfish/jersey/internal/jsr166</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- <execution>
- <id>remove-jdk11-jsr166-META-INF-sources</id>
- <phase>initialize</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>${project.build.directory}/generated-sources/rsrc-gen/META-INF</directory>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- <execution>
- <id>remove-jdk11-jsr166-classes</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>clean</goal>
- </goals>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>${project.build.outputDirectory}/org/glassfish/jersey/internal/jsr166</directory>
- <includes>
- <include>*.class</include>
- </includes>
- <excludes>
- <exclude>Flow*.class</exclude>
- <exclude>SubmittableFlowPublisher.class</exclude>
- <exclude>package-info.class</exclude>
- </excludes>
- </fileset>
- </filesets>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>copy-jdk8-classes-ouputDirectory</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.outputDirectory}</outputDirectory>
- <resources>
- <resource>
- <directory>${java8.build.outputDirectory}</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-jdk8-sources</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/generated-sources/rsrc-gen/org/glassfish/jersey/internal/jsr166</outputDirectory>
- <resources>
- <resource>
- <directory>${java8.sourceDirectory}/org/glassfish/jersey/internal/jsr166</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-jdk11-sources</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/generated-sources/rsrc-gen/META-INF/versions/11/org/glassfish/jersey/internal/jsr166</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.sourceDirectory}/org/glassfish/jersey/internal/jsr166</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- <execution>
- <id>copy-jdk11-classes-to-meta-inf</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.outputDirectory}/META-INF/versions/11</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.build.outputDirectory}</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>3.0.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>package</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- <configuration>
- <excludes>
- <exclude>org/glassfish/jersey/internal/jsr166/Jdk9SubmissionPublisher.java</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
<id>securityOff</id>
<properties>
<surefire.security.argline />
@@ -709,11 +269,6 @@
<properties>
<surefire.security.argline>-Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/surefire.policy</surefire.security.argline>
- <jsr166.sourceDirectory>${project.basedir}/src/main/jsr166</jsr166.sourceDirectory>
- <java8.build.outputDirectory>${project.build.directory}/classes-java8</java8.build.outputDirectory>
- <java8.sourceDirectory>${project.basedir}/src/main/java8</java8.sourceDirectory>
- <java11.build.outputDirectory>${project.build.directory}/classes-java11</java11.build.outputDirectory>
- <java11.sourceDirectory>${project.basedir}/src/main/java11</java11.sourceDirectory>
</properties>
</project>
diff --git a/core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166/Flow.java b/core-common/src/main/java/org/glassfish/jersey/internal/jsr166/Flow.java
similarity index 100%
rename from core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166/Flow.java
rename to core-common/src/main/java/org/glassfish/jersey/internal/jsr166/Flow.java
diff --git a/core-common/src/main/java11/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java b/core-common/src/main/java/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java
similarity index 100%
rename from core-common/src/main/java11/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java
rename to core-common/src/main/java/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java
diff --git a/core-common/src/main/java11/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java b/core-common/src/main/java/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java
similarity index 100%
rename from core-common/src/main/java11/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java
rename to core-common/src/main/java/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java
diff --git a/core-common/src/main/java11/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java b/core-common/src/main/java/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java
similarity index 100%
rename from core-common/src/main/java11/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java
rename to core-common/src/main/java/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java
diff --git a/core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166/SubmittableFlowPublisher.java b/core-common/src/main/java/org/glassfish/jersey/internal/jsr166/SubmittableFlowPublisher.java
similarity index 100%
rename from core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166/SubmittableFlowPublisher.java
rename to core-common/src/main/java/org/glassfish/jersey/internal/jsr166/SubmittableFlowPublisher.java
diff --git a/core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166/package-info.java b/core-common/src/main/java/org/glassfish/jersey/internal/jsr166/package-info.java
similarity index 100%
rename from core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166/package-info.java
rename to core-common/src/main/java/org/glassfish/jersey/internal/jsr166/package-info.java
diff --git a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java b/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java
deleted file mode 100644
index dd25372..0000000
--- a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/JerseyFlowSubscriber.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.internal.jsr166;
-
-public interface JerseyFlowSubscriber<T> extends Flow.Subscriber<T> {
-}
diff --git a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java b/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java
deleted file mode 100644
index 6eb4cb5..0000000
--- a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/SubmissionPublisher.java
+++ /dev/null
@@ -1,1626 +0,0 @@
-/*
- * Written by Doug Lea with assistance from members of JCP JSR-166
- * Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-package org.glassfish.jersey.internal.jsr166;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.ForkJoinTask;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.LockSupport;
-import java.util.function.BiConsumer;
-import java.util.function.BiPredicate;
-import java.util.function.Consumer;
-
-/**
- * A {@link Flow.Publisher} that asynchronously issues submitted
- * (non-null) items to current subscribers until it is closed. Each
- * current subscriber receives newly submitted items in the same order
- * unless drops or exceptions are encountered. Using a
- * SubmissionPublisher allows item generators to act as compliant <a
- * href="http://www.reactive-streams.org/"> reactive-streams</a>
- * Publishers relying on drop handling and/or blocking for flow
- * control.
- * <p>
- * <p>A SubmissionPublisher uses the {@link Executor} supplied in its
- * constructor for delivery to subscribers. The best choice of
- * Executor depends on expected usage. If the generator(s) of
- * submitted items run in separate threads, and the number of
- * subscribers can be estimated, consider using a {@link
- * Executors#newFixedThreadPool}. Otherwise consider using the
- * default, normally the {@link ForkJoinPool#commonPool}.
- * <p>
- * <p>Buffering allows producers and consumers to transiently operate
- * at different rates. Each subscriber uses an independent buffer.
- * Buffers are created upon first use and expanded as needed up to the
- * given maximum. (The enforced capacity may be rounded up to the
- * nearest power of two and/or bounded by the largest value supported
- * by this implementation.) Invocations of {@link
- * Flow.Subscription#request(long) request} do not directly result in
- * buffer expansion, but risk saturation if unfilled requests exceed
- * the maximum capacity. The default value of {@link
- * Flow#defaultBufferSize()} may provide a useful starting point for
- * choosing a capacity based on expected rates, resources, and usages.
- * <p>
- * <p>Publication methods support different policies about what to do
- * when buffers are saturated. Method {@link #submit(Object) submit}
- * blocks until resources are available. This is simplest, but least
- * responsive. The {@code offer} methods may drop items (either
- * immediately or with bounded timeout), but provide an opportunity to
- * interpose a handler and then retry.
- * <p>
- * <p>If any Subscriber method throws an exception, its subscription
- * is cancelled. If a handler is supplied as a constructor argument,
- * it is invoked before cancellation upon an exception in method
- * {@link Flow.Subscriber#onNext onNext}, but exceptions in methods
- * {@link Flow.Subscriber#onSubscribe onSubscribe},
- * {@link Flow.Subscriber#onError(Throwable) onError} and
- * {@link Flow.Subscriber#onComplete() onComplete} are not recorded or
- * handled before cancellation. If the supplied Executor throws
- * {@link RejectedExecutionException} (or any other RuntimeException
- * or Error) when attempting to execute a task, or a drop handler
- * throws an exception when processing a dropped item, then the
- * exception is rethrown. In these cases, not all subscribers will
- * have been issued the published item. It is usually good practice to
- * {@link #closeExceptionally closeExceptionally} in these cases.
- * <p>
- * <p>Method {@link #consume(Consumer)} simplifies support for a
- * common case in which the only action of a subscriber is to request
- * and process all items using a supplied function.
- * <p>
- * <p>This class may also serve as a convenient base for subclasses
- * that generate items, and use the methods in this class to publish
- * them. For example here is a class that periodically publishes the
- * items generated from a supplier. (In practice you might add methods
- * to independently start and stop generation, to share Executors
- * among publishers, and so on, or use a SubmissionPublisher as a
- * component rather than a superclass.)
- * <p>
- * <pre> {@code
- * class PeriodicPublisher<T> extends SubmissionPublisher<T> {
- * final ScheduledFuture<?> periodicTask;
- * final ScheduledExecutorService scheduler;
- * PeriodicPublisher(Executor executor, int maxBufferCapacity,
- * Supplier<? extends T> supplier,
- * long period, TimeUnit unit) {
- * super(executor, maxBufferCapacity);
- * scheduler = new ScheduledThreadPoolExecutor(1);
- * periodicTask = scheduler.scheduleAtFixedRate(
- * () -> submit(supplier.get()), 0, period, unit);
- * }
- * public void close() {
- * periodicTask.cancel(false);
- * scheduler.shutdown();
- * super.close();
- * }
- * }}</pre>
- * <p>
- * <p>Here is an example of a {@link Flow.Processor} implementation.
- * It uses single-step requests to its publisher for simplicity of
- * illustration. A more adaptive version could monitor flow using the
- * lag estimate returned from {@code submit}, along with other utility
- * methods.
- * <p>
- * <pre> {@code
- * class TransformProcessor<S,T> extends SubmissionPublisher<T>
- * implements Flow.Processor<S,T> {
- * final Function<? super S, ? extends T> function;
- * Flow.Subscription subscription;
- * TransformProcessor(Executor executor, int maxBufferCapacity,
- * Function<? super S, ? extends T> function) {
- * super(executor, maxBufferCapacity);
- * this.function = function;
- * }
- * public void onSubscribe(Flow.Subscription subscription) {
- * (this.subscription = subscription).request(1);
- * }
- * public void onNext(S item) {
- * subscription.request(1);
- * submit(function.apply(item));
- * }
- * public void onError(Throwable ex) { closeExceptionally(ex); }
- * public void onComplete() { close(); }
- * }}</pre>
- *
- * @param <T> the published item type
- * @author Doug Lea
- * @since 9
- */
-public class SubmissionPublisher<T> implements Flow.Publisher<T>, SubmittableFlowPublisher<T>,
- AutoCloseable {
- /*
- * Most mechanics are handled by BufferedSubscription. This class
- * mainly tracks subscribers and ensures sequentiality, by using
- * built-in synchronization locks across public methods. (Using
- * built-in locks works well in the most typical case in which
- * only one thread submits items).
- */
-
- /**
- * The largest possible power of two array size.
- */
- static final int BUFFER_CAPACITY_LIMIT = 1 << 30;
-
- /**
- * Round capacity to power of 2, at most limit.
- */
- static final int roundCapacity(int cap) {
- int n = cap - 1;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- return (n <= 0) ? 1 : // at least 1
- (n >= BUFFER_CAPACITY_LIMIT) ? BUFFER_CAPACITY_LIMIT : n + 1;
- }
-
- // default Executor setup; nearly the same as CompletableFuture
-
- /**
- * Default executor -- ForkJoinPool.commonPool() unless it cannot
- * support parallelism.
- */
- private static final Executor ASYNC_POOL =
- (ForkJoinPool.getCommonPoolParallelism() > 1) ? ForkJoinPool.commonPool() : new ThreadPerTaskExecutor();
-
- /**
- * Fallback if ForkJoinPool.commonPool() cannot support parallelism
- */
- private static final class ThreadPerTaskExecutor implements Executor {
- public void execute(Runnable r) {
- new Thread(r).start();
- }
- }
-
- /**
- * Clients (BufferedSubscriptions) are maintained in a linked list
- * (via their "next" fields). This works well for publish loops.
- * It requires O(n) traversal to check for duplicate subscribers,
- * but we expect that subscribing is much less common than
- * publishing. Unsubscribing occurs only during traversal loops,
- * when BufferedSubscription methods return negative values
- * signifying that they have been disabled. To reduce
- * head-of-line blocking, submit and offer methods first call
- * BufferedSubscription.offer on each subscriber, and place
- * saturated ones in retries list (using nextRetry field), and
- * retry, possibly blocking or dropping.
- */
- BufferedSubscription<T> clients;
-
- /**
- * Run status, updated only within locks
- */
- volatile boolean closed;
- /**
- * If non-null, the exception in closeExceptionally
- */
- volatile Throwable closedException;
-
- // Parameters for constructing BufferedSubscriptions
- final Executor executor;
- final BiConsumer<? super Flow.Subscriber<? super T>, ? super Throwable> onNextHandler;
- final int maxBufferCapacity;
-
- /**
- * Creates a new SubmissionPublisher using the given Executor for
- * async delivery to subscribers, with the given maximum buffer size
- * for each subscriber, and, if non-null, the given handler invoked
- * when any Subscriber throws an exception in method {@link
- * Flow.Subscriber#onNext(Object) onNext}.
- *
- * @param executor the executor to use for async delivery,
- * supporting creation of at least one independent thread
- * @param maxBufferCapacity the maximum capacity for each
- * subscriber's buffer (the enforced capacity may be rounded up to
- * the nearest power of two and/or bounded by the largest value
- * supported by this implementation; method {@link #getMaxBufferCapacity}
- * returns the actual value)
- * @param handler if non-null, procedure to invoke upon exception
- * thrown in method {@code onNext}
- * @throws NullPointerException if executor is null
- * @throws IllegalArgumentException if maxBufferCapacity not
- * positive
- */
- public SubmissionPublisher(Executor executor, int maxBufferCapacity,
- BiConsumer<? super Flow.Subscriber<? super T>, ? super Throwable> handler) {
- if (executor == null) {
- throw new NullPointerException();
- }
- if (maxBufferCapacity <= 0) {
- throw new IllegalArgumentException("capacity must be positive");
- }
- this.executor = executor;
- this.onNextHandler = handler;
- this.maxBufferCapacity = roundCapacity(maxBufferCapacity);
- }
-
- /**
- * Creates a new SubmissionPublisher using the given Executor for
- * async delivery to subscribers, with the given maximum buffer size
- * for each subscriber, and no handler for Subscriber exceptions in
- * method {@link Flow.Subscriber#onNext(Object) onNext}.
- *
- * @param executor the executor to use for async delivery,
- * supporting creation of at least one independent thread
- * @param maxBufferCapacity the maximum capacity for each
- * subscriber's buffer (the enforced capacity may be rounded up to
- * the nearest power of two and/or bounded by the largest value
- * supported by this implementation; method {@link #getMaxBufferCapacity}
- * returns the actual value)
- * @throws NullPointerException if executor is null
- * @throws IllegalArgumentException if maxBufferCapacity not
- * positive
- */
- public SubmissionPublisher(Executor executor, int maxBufferCapacity) {
- this(executor, maxBufferCapacity, null);
- }
-
- /**
- * Creates a new SubmissionPublisher using the {@link
- * ForkJoinPool#commonPool()} for async delivery to subscribers
- * (unless it does not support a parallelism level of at least two,
- * in which case, a new Thread is created to run each task), with
- * maximum buffer capacity of {@link Flow#defaultBufferSize}, and no
- * handler for Subscriber exceptions in method {@link
- * Flow.Subscriber#onNext(Object) onNext}.
- */
- public SubmissionPublisher() {
- this(ASYNC_POOL, Flow.defaultBufferSize(), null);
- }
-
- /**
- * Adds the given Subscriber unless already subscribed. If already
- * subscribed, the Subscriber's {@link
- * Flow.Subscriber#onError(Throwable) onError} method is invoked on
- * the existing subscription with an {@link IllegalStateException}.
- * Otherwise, upon success, the Subscriber's {@link
- * Flow.Subscriber#onSubscribe onSubscribe} method is invoked
- * asynchronously with a new {@link Flow.Subscription}. If {@link
- * Flow.Subscriber#onSubscribe onSubscribe} throws an exception, the
- * subscription is cancelled. Otherwise, if this SubmissionPublisher
- * was closed exceptionally, then the subscriber's {@link
- * Flow.Subscriber#onError onError} method is invoked with the
- * corresponding exception, or if closed without exception, the
- * subscriber's {@link Flow.Subscriber#onComplete() onComplete}
- * method is invoked. Subscribers may enable receiving items by
- * invoking the {@link Flow.Subscription#request(long) request}
- * method of the new Subscription, and may unsubscribe by invoking
- * its {@link Flow.Subscription#cancel() cancel} method.
- *
- * @param subscriber the subscriber
- * @throws NullPointerException if subscriber is null
- */
- public void subscribe(Flow.Subscriber<? super T> subscriber) {
- if (subscriber == null) {
- throw new NullPointerException();
- }
- BufferedSubscription<T> subscription =
- new BufferedSubscription<T>(subscriber, executor,
- onNextHandler, maxBufferCapacity);
- synchronized (this) {
- for (BufferedSubscription<T> b = clients, pred = null;;) {
- if (b == null) {
- Throwable ex;
- subscription.onSubscribe();
- if ((ex = closedException) != null) {
- subscription.onError(ex);
- } else if (closed) {
- subscription.onComplete();
- } else if (pred == null) {
- clients = subscription;
- } else {
- pred.next = subscription;
- }
- break;
- }
- BufferedSubscription<T> next = b.next;
- if (b.isDisabled()) { // remove
- b.next = null; // detach
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else if (subscriber.equals(b.subscriber)) {
- b.onError(new IllegalStateException("Duplicate subscribe"));
- break;
- } else {
- pred = b;
- }
- b = next;
- }
- }
- }
-
- /**
- * Publishes the given item to each current subscriber by
- * asynchronously invoking its {@link Flow.Subscriber#onNext(Object)
- * onNext} method, blocking uninterruptibly while resources for any
- * subscriber are unavailable. This method returns an estimate of
- * the maximum lag (number of items submitted but not yet consumed)
- * among all current subscribers. This value is at least one
- * (accounting for this submitted item) if there are any
- * subscribers, else zero.
- * <p>
- * <p>If the Executor for this publisher throws a
- * RejectedExecutionException (or any other RuntimeException or
- * Error) when attempting to asynchronously notify subscribers,
- * then this exception is rethrown, in which case not all
- * subscribers will have been issued this item.
- *
- * @param item the (non-null) item to publish
- * @return the estimated maximum lag among subscribers
- * @throws IllegalStateException if closed
- * @throws NullPointerException if item is null
- * @throws RejectedExecutionException if thrown by Executor
- */
- public int submit(T item) {
- if (item == null) {
- throw new NullPointerException();
- }
- int lag = 0;
- boolean complete;
- synchronized (this) {
- complete = closed;
- BufferedSubscription<T> b = clients;
- if (!complete) {
- BufferedSubscription<T> pred = null, r = null, rtail = null;
- while (b != null) {
- BufferedSubscription<T> next = b.next;
- int stat = b.offer(item);
- if (stat < 0) { // disabled
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else {
- if (stat > lag) {
- lag = stat;
- } else if (stat == 0) { // place on retry list
- b.nextRetry = null;
- if (rtail == null) {
- r = b;
- } else {
- rtail.nextRetry = b;
- }
- rtail = b;
- }
- pred = b;
- }
- b = next;
- }
- while (r != null) {
- BufferedSubscription<T> nextRetry = r.nextRetry;
- r.nextRetry = null;
- int stat = r.submit(item);
- if (stat > lag) {
- lag = stat;
- } else if (stat < 0 && clients == r) {
- clients = r.next; // postpone internal unsubscribes
- }
- r = nextRetry;
- }
- }
- }
- if (complete) {
- throw new IllegalStateException("Closed");
- } else {
- return lag;
- }
- }
-
- /**
- * Publishes the given item, if possible, to each current subscriber
- * by asynchronously invoking its {@link
- * Flow.Subscriber#onNext(Object) onNext} method. The item may be
- * dropped by one or more subscribers if resource limits are
- * exceeded, in which case the given handler (if non-null) is
- * invoked, and if it returns true, retried once. Other calls to
- * methods in this class by other threads are blocked while the
- * handler is invoked. Unless recovery is assured, options are
- * usually limited to logging the error and/or issuing an {@link
- * Flow.Subscriber#onError(Throwable) onError} signal to the
- * subscriber.
- * <p>
- * <p>This method returns a status indicator: If negative, it
- * represents the (negative) number of drops (failed attempts to
- * issue the item to a subscriber). Otherwise it is an estimate of
- * the maximum lag (number of items submitted but not yet
- * consumed) among all current subscribers. This value is at least
- * one (accounting for this submitted item) if there are any
- * subscribers, else zero.
- * <p>
- * <p>If the Executor for this publisher throws a
- * RejectedExecutionException (or any other RuntimeException or
- * Error) when attempting to asynchronously notify subscribers, or
- * the drop handler throws an exception when processing a dropped
- * item, then this exception is rethrown.
- *
- * @param item the (non-null) item to publish
- * @param onDrop if non-null, the handler invoked upon a drop to a
- * subscriber, with arguments of the subscriber and item; if it
- * returns true, an offer is re-attempted (once)
- * @return if negative, the (negative) number of drops; otherwise
- * an estimate of maximum lag
- * @throws IllegalStateException if closed
- * @throws NullPointerException if item is null
- * @throws RejectedExecutionException if thrown by Executor
- */
- public int offer(T item,
- BiPredicate<Flow.Subscriber<? super T>, ? super T> onDrop) {
- return doOffer(0L, item, onDrop);
- }
-
- /**
- * Publishes the given item, if possible, to each current subscriber
- * by asynchronously invoking its {@link
- * Flow.Subscriber#onNext(Object) onNext} method, blocking while
- * resources for any subscription are unavailable, up to the
- * specified timeout or until the caller thread is interrupted, at
- * which point the given handler (if non-null) is invoked, and if it
- * returns true, retried once. (The drop handler may distinguish
- * timeouts from interrupts by checking whether the current thread
- * is interrupted.) Other calls to methods in this class by other
- * threads are blocked while the handler is invoked. Unless
- * recovery is assured, options are usually limited to logging the
- * error and/or issuing an {@link Flow.Subscriber#onError(Throwable)
- * onError} signal to the subscriber.
- * <p>
- * <p>This method returns a status indicator: If negative, it
- * represents the (negative) number of drops (failed attempts to
- * issue the item to a subscriber). Otherwise it is an estimate of
- * the maximum lag (number of items submitted but not yet
- * consumed) among all current subscribers. This value is at least
- * one (accounting for this submitted item) if there are any
- * subscribers, else zero.
- * <p>
- * <p>If the Executor for this publisher throws a
- * RejectedExecutionException (or any other RuntimeException or
- * Error) when attempting to asynchronously notify subscribers, or
- * the drop handler throws an exception when processing a dropped
- * item, then this exception is rethrown.
- *
- * @param item the (non-null) item to publish
- * @param timeout how long to wait for resources for any subscriber
- * before giving up, in units of {@code unit}
- * @param unit a {@code TimeUnit} determining how to interpret the
- * {@code timeout} parameter
- * @param onDrop if non-null, the handler invoked upon a drop to a
- * subscriber, with arguments of the subscriber and item; if it
- * returns true, an offer is re-attempted (once)
- * @return if negative, the (negative) number of drops; otherwise
- * an estimate of maximum lag
- * @throws IllegalStateException if closed
- * @throws NullPointerException if item is null
- * @throws RejectedExecutionException if thrown by Executor
- */
- public int offer(T item, long timeout, TimeUnit unit,
- BiPredicate<Flow.Subscriber<? super T>, ? super T> onDrop) {
- return doOffer(unit.toNanos(timeout), item, onDrop);
- }
-
- /**
- * Common implementation for both forms of offer
- */
- final int doOffer(long nanos, T item,
- BiPredicate<Flow.Subscriber<? super T>, ? super T> onDrop) {
- if (item == null) {
- throw new NullPointerException();
- }
- int lag = 0, drops = 0;
- boolean complete;
- synchronized (this) {
- complete = closed;
- BufferedSubscription<T> b = clients;
- if (!complete) {
- BufferedSubscription<T> pred = null, r = null, rtail = null;
- while (b != null) {
- BufferedSubscription<T> next = b.next;
- int stat = b.offer(item);
- if (stat < 0) {
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else {
- if (stat > lag) {
- lag = stat;
- } else if (stat == 0) {
- b.nextRetry = null;
- if (rtail == null) {
- r = b;
- } else {
- rtail.nextRetry = b;
- }
- rtail = b;
- } else if (stat > lag) {
- lag = stat;
- }
- pred = b;
- }
- b = next;
- }
- while (r != null) {
- BufferedSubscription<T> nextRetry = r.nextRetry;
- r.nextRetry = null;
- int stat = (nanos > 0L)
- ? r.timedOffer(item, nanos)
- : r.offer(item);
- if (stat == 0 && onDrop != null && onDrop.test(r.subscriber, item)) {
- stat = r.offer(item);
- }
- if (stat == 0) {
- ++drops;
- } else if (stat > lag) {
- lag = stat;
- } else if (stat < 0 && clients == r) {
- clients = r.next;
- }
- r = nextRetry;
- }
- }
- }
- if (complete) {
- throw new IllegalStateException("Closed");
- } else {
- return (drops > 0) ? -drops : lag;
- }
- }
-
- /**
- * Unless already closed, issues {@link
- * Flow.Subscriber#onComplete() onComplete} signals to current
- * subscribers, and disallows subsequent attempts to publish.
- * Upon return, this method does <em>NOT</em> guarantee that all
- * subscribers have yet completed.
- */
- public void close() {
- if (!closed) {
- BufferedSubscription<T> b;
- synchronized (this) {
- b = clients;
- clients = null;
- closed = true;
- }
- while (b != null) {
- BufferedSubscription<T> next = b.next;
- b.next = null;
- b.onComplete();
- b = next;
- }
- }
- }
-
- /**
- * Unless already closed, issues {@link
- * Flow.Subscriber#onError(Throwable) onError} signals to current
- * subscribers with the given error, and disallows subsequent
- * attempts to publish. Future subscribers also receive the given
- * error. Upon return, this method does <em>NOT</em> guarantee
- * that all subscribers have yet completed.
- *
- * @param error the {@code onError} argument sent to subscribers
- * @throws NullPointerException if error is null
- */
- public void closeExceptionally(Throwable error) {
- if (error == null) {
- throw new NullPointerException();
- }
- if (!closed) {
- BufferedSubscription<T> b;
- synchronized (this) {
- b = clients;
- clients = null;
- closed = true;
- closedException = error;
- }
- while (b != null) {
- BufferedSubscription<T> next = b.next;
- b.next = null;
- b.onError(error);
- b = next;
- }
- }
- }
-
- /**
- * Returns true if this publisher is not accepting submissions.
- *
- * @return true if closed
- */
- public boolean isClosed() {
- return closed;
- }
-
- /**
- * Returns the exception associated with {@link
- * #closeExceptionally(Throwable) closeExceptionally}, or null if
- * not closed or if closed normally.
- *
- * @return the exception, or null if none
- */
- public Throwable getClosedException() {
- return closedException;
- }
-
- /**
- * Returns true if this publisher has any subscribers.
- *
- * @return true if this publisher has any subscribers
- */
- public boolean hasSubscribers() {
- boolean nonEmpty = false;
- if (!closed) {
- synchronized (this) {
- for (BufferedSubscription<T> b = clients; b != null; ) {
- BufferedSubscription<T> next = b.next;
- if (b.isDisabled()) {
- b.next = null;
- b = clients = next;
- } else {
- nonEmpty = true;
- break;
- }
- }
- }
- }
- return nonEmpty;
- }
-
- /**
- * Returns the number of current subscribers.
- *
- * @return the number of current subscribers
- */
- public int getNumberOfSubscribers() {
- int count = 0;
- if (!closed) {
- synchronized (this) {
- BufferedSubscription<T> pred = null, next;
- for (BufferedSubscription<T> b = clients; b != null; b = next) {
- next = b.next;
- if (b.isDisabled()) {
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else {
- pred = b;
- ++count;
- }
- }
- }
- }
- return count;
- }
-
- /**
- * Returns the Executor used for asynchronous delivery.
- *
- * @return the Executor used for asynchronous delivery
- */
- public Executor getExecutor() {
- return executor;
- }
-
- /**
- * Returns the maximum per-subscriber buffer capacity.
- *
- * @return the maximum per-subscriber buffer capacity
- */
- public int getMaxBufferCapacity() {
- return maxBufferCapacity;
- }
-
- /**
- * Returns a list of current subscribers for monitoring and
- * tracking purposes, not for invoking {@link Flow.Subscriber}
- * methods on the subscribers.
- *
- * @return list of current subscribers
- */
- public List<Flow.Subscriber<? super T>> getSubscribers() {
- ArrayList<Flow.Subscriber<? super T>> subs = new ArrayList<>();
- synchronized (this) {
- BufferedSubscription<T> pred = null, next;
- for (BufferedSubscription<T> b = clients; b != null; b = next) {
- next = b.next;
- if (b.isDisabled()) {
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else {
- subs.add(b.subscriber);
- }
- }
- }
- return subs;
- }
-
- /**
- * Returns true if the given Subscriber is currently subscribed.
- *
- * @param subscriber the subscriber
- * @return true if currently subscribed
- * @throws NullPointerException if subscriber is null
- */
- public boolean isSubscribed(Flow.Subscriber<? super T> subscriber) {
- if (subscriber == null) {
- throw new NullPointerException();
- }
- if (!closed) {
- synchronized (this) {
- BufferedSubscription<T> pred = null, next;
- for (BufferedSubscription<T> b = clients; b != null; b = next) {
- next = b.next;
- if (b.isDisabled()) {
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else if (subscriber.equals(b.subscriber)) {
- return true;
- } else {
- pred = b;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Returns an estimate of the minimum number of items requested
- * (via {@link Flow.Subscription#request(long) request}) but not
- * yet produced, among all current subscribers.
- *
- * @return the estimate, or zero if no subscribers
- */
- public long estimateMinimumDemand() {
- long min = Long.MAX_VALUE;
- boolean nonEmpty = false;
- synchronized (this) {
- BufferedSubscription<T> pred = null, next;
- for (BufferedSubscription<T> b = clients; b != null; b = next) {
- int n;
- long d;
- next = b.next;
- if ((n = b.estimateLag()) < 0) {
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else {
- if ((d = b.demand - n) < min) {
- min = d;
- }
- nonEmpty = true;
- pred = b;
- }
- }
- }
- return nonEmpty ? min : 0;
- }
-
- /**
- * Returns an estimate of the maximum number of items produced but
- * not yet consumed among all current subscribers.
- *
- * @return the estimate
- */
- public int estimateMaximumLag() {
- int max = 0;
- synchronized (this) {
- BufferedSubscription<T> pred = null, next;
- for (BufferedSubscription<T> b = clients; b != null; b = next) {
- int n;
- next = b.next;
- if ((n = b.estimateLag()) < 0) {
- b.next = null;
- if (pred == null) {
- clients = next;
- } else {
- pred.next = next;
- }
- } else {
- if (n > max) {
- max = n;
- }
- pred = b;
- }
- }
- }
- return max;
- }
-
- /**
- * Processes all published items using the given Consumer function.
- * Returns a CompletableFuture that is completed normally when this
- * publisher signals {@link Flow.Subscriber#onComplete()
- * onComplete}, or completed exceptionally upon any error, or an
- * exception is thrown by the Consumer, or the returned
- * CompletableFuture is cancelled, in which case no further items
- * are processed.
- *
- * @param consumer the function applied to each onNext item
- * @return a CompletableFuture that is completed normally
- * when the publisher signals onComplete, and exceptionally
- * upon any error or cancellation
- * @throws NullPointerException if consumer is null
- */
- public CompletableFuture<Void> consume(Consumer<? super T> consumer) {
- if (consumer == null) {
- throw new NullPointerException();
- }
- CompletableFuture<Void> status = new CompletableFuture<>();
- subscribe(new ConsumerSubscriber<T>(status, consumer));
- return status;
- }
-
- /**
- * Subscriber for method consume
- */
- private static final class ConsumerSubscriber<T>
- implements Flow.Subscriber<T> {
- final CompletableFuture<Void> status;
- final Consumer<? super T> consumer;
- Flow.Subscription subscription;
-
- ConsumerSubscriber(CompletableFuture<Void> status,
- Consumer<? super T> consumer) {
- this.status = status;
- this.consumer = consumer;
- }
-
- public final void onSubscribe(Flow.Subscription subscription) {
- this.subscription = subscription;
- status.whenComplete((v, e) -> subscription.cancel());
- if (!status.isDone()) {
- subscription.request(Long.MAX_VALUE);
- }
- }
-
- public final void onError(Throwable ex) {
- status.completeExceptionally(ex);
- }
-
- public final void onComplete() {
- status.complete(null);
- }
-
- public final void onNext(T item) {
- try {
- consumer.accept(item);
- } catch (Throwable ex) {
- subscription.cancel();
- status.completeExceptionally(ex);
- }
- }
- }
-
- /**
- * A task for consuming buffer items and signals, created and
- * executed whenever they become available. A task consumes as
- * many items/signals as possible before terminating, at which
- * point another task is created when needed. The dual Runnable
- * and ForkJoinTask declaration saves overhead when executed by
- * ForkJoinPools, without impacting other kinds of Executors.
- */
- @SuppressWarnings("serial")
- static final class ConsumerTask<T> extends ForkJoinTask<Void>
- implements Runnable, CompletableFuture.AsynchronousCompletionTask {
- final BufferedSubscription<T> consumer;
-
- ConsumerTask(BufferedSubscription<T> consumer) {
- this.consumer = consumer;
- }
-
- public final Void getRawResult() {
- return null;
- }
-
- public final void setRawResult(Void v) {
- }
-
- public final boolean exec() {
- consumer.consume();
- return false;
- }
-
- public final void run() {
- consumer.consume();
- }
- }
-
- /**
- * A bounded (ring) buffer with integrated control to start a
- * consumer task whenever items are available. The buffer
- * algorithm is similar to one used inside ForkJoinPool (see its
- * internal documentation for details) specialized for the case of
- * at most one concurrent producer and consumer, and power of two
- * buffer sizes. This allows methods to operate without locks even
- * while supporting resizing, blocking, task-triggering, and
- * garbage-free buffers (nulling out elements when consumed),
- * although supporting these does impose a bit of overhead
- * compared to plain fixed-size ring buffers.
- * <p>
- * The publisher guarantees a single producer via its lock. We
- * ensure in this class that there is at most one consumer. The
- * request and cancel methods must be fully thread-safe but are
- * coded to exploit the most common case in which they are only
- * called by consumers (usually within onNext).
- * <p>
- * Execution control is managed using the ACTIVE ctl bit. We
- * ensure that a task is active when consumable items (and
- * usually, SUBSCRIBE, ERROR or COMPLETE signals) are present and
- * there is demand (unfilled requests). This is complicated on
- * the creation side by the possibility of exceptions when trying
- * to execute tasks. These eventually force DISABLED state, but
- * sometimes not directly. On the task side, termination (clearing
- * ACTIVE) that would otherwise race with producers or request()
- * calls uses the CONSUME keep-alive bit to force a recheck.
- * <p>
- * The ctl field also manages run state. When DISABLED, no further
- * updates are possible. Disabling may be preceded by setting
- * ERROR or COMPLETE (or both -- ERROR has precedence), in which
- * case the associated Subscriber methods are invoked, possibly
- * synchronously if there is no active consumer task (including
- * cases where execute() failed). The cancel() method is supported
- * by treating as ERROR but suppressing onError signal.
- * <p>
- * Support for blocking also exploits the fact that there is only
- * one possible waiter. ManagedBlocker-compatible control fields
- * are placed in this class itself rather than in wait-nodes.
- * Blocking control relies on the "waiter" field. Producers set
- * the field before trying to block, but must then recheck (via
- * offer) before parking. Signalling then just unparks and clears
- * waiter field. If the producer and/or consumer are using a
- * ForkJoinPool, the producer attempts to help run consumer tasks
- * via ForkJoinPool.helpAsyncBlocker before blocking.
- * <p>
- * This class uses @Contended and heuristic field declaration
- * ordering to reduce false-sharing-based memory contention among
- * instances of BufferedSubscription, but it does not currently
- * attempt to avoid memory contention among buffers. This field
- * and element packing can hurt performance especially when each
- * publisher has only one client operating at a high rate.
- * Addressing this may require allocating substantially more space
- * than users expect.
- */
- @SuppressWarnings("serial")
- @sun.misc.Contended
- private static final class BufferedSubscription<T>
- implements Flow.Subscription, ForkJoinPool.ManagedBlocker {
- // Order-sensitive field declarations
- long timeout; // > 0 if timed wait
- volatile long demand; // # unfilled requests
- int maxCapacity; // reduced on OOME
- int putStat; // offer result for ManagedBlocker
- volatile int ctl; // atomic run state flags
- volatile int head; // next position to take
- int tail; // next position to put
- Object[] array; // buffer: null if disabled
- Flow.Subscriber<? super T> subscriber; // null if disabled
- Executor executor; // null if disabled
- BiConsumer<? super Flow.Subscriber<? super T>, ? super Throwable> onNextHandler;
- volatile Throwable pendingError; // holds until onError issued
- volatile Thread waiter; // blocked producer thread
- T putItem; // for offer within ManagedBlocker
- BufferedSubscription<T> next; // used only by publisher
- BufferedSubscription<T> nextRetry; // used only by publisher
-
- // ctl values
- static final int ACTIVE = 0x01; // consumer task active
- static final int CONSUME = 0x02; // keep-alive for consumer task
- static final int DISABLED = 0x04; // final state
- static final int ERROR = 0x08; // signal onError then disable
- static final int SUBSCRIBE = 0x10; // signal onSubscribe
- static final int COMPLETE = 0x20; // signal onComplete when done
-
- static final long INTERRUPTED = -1L; // timeout vs interrupt sentinel
-
- /**
- * Initial buffer capacity used when maxBufferCapacity is
- * greater. Must be a power of two.
- */
- static final int DEFAULT_INITIAL_CAP = 32;
-
- BufferedSubscription(Flow.Subscriber<? super T> subscriber,
- Executor executor,
- BiConsumer<? super Flow.Subscriber<? super T>,
- ? super Throwable> onNextHandler,
- int maxBufferCapacity) {
- this.subscriber = subscriber;
- this.executor = executor;
- this.onNextHandler = onNextHandler;
- this.maxCapacity = maxBufferCapacity;
- this.array = new Object[maxBufferCapacity < DEFAULT_INITIAL_CAP
- ? (maxBufferCapacity < 2 // at least 2 slots
- ? 2 : maxBufferCapacity)
- : DEFAULT_INITIAL_CAP];
- }
-
- @Override
- public String toString() {
- if (subscriber != null) {
- return subscriber.toString();
- } else {
- return super.toString();
- }
- }
-
- final boolean isDisabled() {
- return ctl == DISABLED;
- }
-
- /**
- * Returns estimated number of buffered items, or -1 if
- * disabled.
- */
- final int estimateLag() {
- int n;
- return (ctl == DISABLED) ? -1 : ((n = tail - head) > 0) ? n : 0;
- }
-
- /**
- * Tries to add item and start consumer task if necessary.
- *
- * @return -1 if disabled, 0 if dropped, else estimated lag
- */
- final int offer(T item) {
- int h = head, t = tail, cap, size, stat;
- Object[] a = array;
- if (a != null && (cap = a.length) > 0 && cap >= (size = t + 1 - h)) {
- a[(cap - 1) & t] = item; // relaxed writes OK
- tail = t + 1;
- stat = size;
- } else {
- stat = growAndAdd(a, item);
- }
- return (stat > 0 && (ctl & (ACTIVE | CONSUME)) != (ACTIVE | CONSUME)) ? startOnOffer(stat) : stat;
- }
-
- /**
- * Tries to create or expand buffer, then adds item if possible.
- */
- private int growAndAdd(Object[] a, T item) {
- boolean alloc;
- int cap, stat;
- if ((ctl & (ERROR | DISABLED)) != 0) {
- cap = 0;
- stat = -1;
- alloc = false;
- } else if (a == null || (cap = a.length) <= 0) {
- cap = 0;
- stat = 1;
- alloc = true;
- } else {
- U.fullFence(); // recheck
- int h = head, t = tail, size = t + 1 - h;
- if (cap >= size) {
- a[(cap - 1) & t] = item;
- tail = t + 1;
- stat = size;
- alloc = false;
- } else if (cap >= maxCapacity) {
- stat = 0; // cannot grow
- alloc = false;
- } else {
- stat = cap + 1;
- alloc = true;
- }
- }
- if (alloc) {
- int newCap = (cap > 0) ? cap << 1 : 1;
- if (newCap <= cap) {
- stat = 0;
- } else {
- Object[] newArray = null;
- try {
- newArray = new Object[newCap];
- } catch (Throwable ex) { // try to cope with OOME
- }
- if (newArray == null) {
- if (cap > 0) {
- maxCapacity = cap; // avoid continuous failure
- }
- stat = 0;
- } else {
- array = newArray;
- int t = tail;
- int newMask = newCap - 1;
- if (a != null && cap > 0) {
- int mask = cap - 1;
- for (int j = head; j != t; ++j) {
- long k = ((long) (j & mask) << ASHIFT) + ABASE;
- Object x = U.getObjectVolatile(a, k);
- if (x != null && // races with consumer
- U.compareAndSwapObject(a, k, x, null)) {
- newArray[j & newMask] = x;
- }
- }
- }
- newArray[t & newMask] = item;
- tail = t + 1;
- }
- }
- }
- return stat;
- }
-
- /**
- * Spins/helps/blocks while offer returns 0. Called only if
- * initial offer return 0.
- */
- final int submit(T item) {
- int stat;
- if ((stat = offer(item)) == 0) {
- putItem = item;
- timeout = 0L;
- putStat = 0;
- // safe to comment out when executor != ForkJoinPool (TODO)
- // ForkJoinPool.helpAsyncBlocker(executor, this);
- if ((stat = putStat) == 0) {
- try {
- ForkJoinPool.managedBlock(this);
- } catch (InterruptedException ie) {
- timeout = INTERRUPTED;
- }
- stat = putStat;
- }
- if (timeout < 0L) {
- Thread.currentThread().interrupt();
- }
- }
- return stat;
- }
-
- /**
- * Timeout version; similar to submit.
- */
- final int timedOffer(T item, long nanos) {
- int stat;
- if ((stat = offer(item)) == 0 && (timeout = nanos) > 0L) {
- putItem = item;
- putStat = 0;
- // safe to comment out when executor != ForkJoinPool (TODO)
- // ForkJoinPool.helpAsyncBlocker(executor, this);
- if ((stat = putStat) == 0) {
- try {
- ForkJoinPool.managedBlock(this);
- } catch (InterruptedException ie) {
- timeout = INTERRUPTED;
- }
- stat = putStat;
- }
- if (timeout < 0L) {
- Thread.currentThread().interrupt();
- }
- }
- return stat;
- }
-
- /**
- * Tries to start consumer task after offer.
- *
- * @return -1 if now disabled, else argument
- */
- private int startOnOffer(int stat) {
- for (;;) {
- Executor e;
- int c;
- if ((c = ctl) == DISABLED || (e = executor) == null) {
- stat = -1;
- break;
- } else if ((c & ACTIVE) != 0) { // ensure keep-alive
- if ((c & CONSUME) != 0 || U.compareAndSwapInt(this, CTL, c, c | CONSUME)) {
- break;
- }
- } else if (demand == 0L || tail == head) {
- break;
- } else if (U.compareAndSwapInt(this, CTL, c,
- c | (ACTIVE | CONSUME))) {
- try {
- e.execute(new ConsumerTask<T>(this));
- break;
- } catch (RuntimeException | Error ex) { // back out
- do {
- } while (((c = ctl) & DISABLED) == 0
- && (c & ACTIVE) != 0
- && !U.compareAndSwapInt(this, CTL, c, c & ~ACTIVE));
- throw ex;
- }
- }
- }
- return stat;
- }
-
- private void signalWaiter(Thread w) {
- waiter = null;
- LockSupport.unpark(w); // release producer
- }
-
- /**
- * Nulls out most fields, mainly to avoid garbage retention
- * until publisher unsubscribes, but also to help cleanly stop
- * upon error by nulling required components.
- */
- private void detach() {
- Thread w = waiter;
- executor = null;
- subscriber = null;
- pendingError = null;
- signalWaiter(w);
- }
-
- /**
- * Issues error signal, asynchronously if a task is running,
- * else synchronously.
- */
- final void onError(Throwable ex) {
- for (int c;;) {
- if (((c = ctl) & (ERROR | DISABLED)) != 0) {
- break;
- } else if ((c & ACTIVE) != 0) {
- pendingError = ex;
- if (U.compareAndSwapInt(this, CTL, c, c | ERROR)) {
- break; // cause consumer task to exit
- }
- } else if (U.compareAndSwapInt(this, CTL, c, DISABLED)) {
- Flow.Subscriber<? super T> s = subscriber;
- if (s != null && ex != null) {
- try {
- s.onError(ex);
- } catch (Throwable ignore) {
- }
- }
- detach();
- break;
- }
- }
- }
-
- /**
- * Tries to start consumer task upon a signal or request;
- * disables on failure.
- */
- private void startOrDisable() {
- Executor e;
- if ((e = executor) != null) { // skip if already disabled
- try {
- e.execute(new ConsumerTask<T>(this));
- } catch (Throwable ex) { // back out and force signal
- for (int c;;) {
- if ((c = ctl) == DISABLED || (c & ACTIVE) == 0) {
- break;
- }
- if (U.compareAndSwapInt(this, CTL, c, c & ~ACTIVE)) {
- onError(ex);
- break;
- }
- }
- }
- }
- }
-
- final void onComplete() {
- for (int c;;) {
- if ((c = ctl) == DISABLED) {
- break;
- }
- if (U.compareAndSwapInt(this, CTL, c,
- c | (ACTIVE | CONSUME | COMPLETE))) {
- if ((c & ACTIVE) == 0) {
- startOrDisable();
- }
- break;
- }
- }
- }
-
- final void onSubscribe() {
- for (int c;;) {
- if ((c = ctl) == DISABLED) {
- break;
- }
- if (U.compareAndSwapInt(this, CTL, c,
- c | (ACTIVE | CONSUME | SUBSCRIBE))) {
- if ((c & ACTIVE) == 0) {
- startOrDisable();
- }
- break;
- }
- }
- }
-
- /**
- * Causes consumer task to exit if active (without reporting
- * onError unless there is already a pending error), and
- * disables.
- */
- public void cancel() {
- for (int c;;) {
- if ((c = ctl) == DISABLED) {
- break;
- } else if ((c & ACTIVE) != 0) {
- if (U.compareAndSwapInt(this, CTL, c,
- c | (CONSUME | ERROR))) {
- break;
- }
- } else if (U.compareAndSwapInt(this, CTL, c, DISABLED)) {
- detach();
- break;
- }
- }
- }
-
- /**
- * Adds to demand and possibly starts task.
- */
- public void request(long n) {
- if (n > 0L) {
- for (;;) {
- long prev = demand, d;
- if ((d = prev + n) < prev) { // saturate
- d = Long.MAX_VALUE;
- }
- if (U.compareAndSwapLong(this, DEMAND, prev, d)) {
- for (int c, h;; ) {
- if ((c = ctl) == DISABLED) {
- break;
- } else if ((c & ACTIVE) != 0) {
- if ((c & CONSUME) != 0 || U.compareAndSwapInt(this, CTL, c, c | CONSUME)) {
- break;
- }
- } else if ((h = head) != tail) {
- if (U.compareAndSwapInt(this, CTL, c,
- c | (ACTIVE | CONSUME))) {
- startOrDisable();
- break;
- }
- } else if (head == h && tail == h) {
- break; // else stale
- }
- if (demand == 0L) {
- break;
- }
- }
- break;
- }
- }
- } else if (n < 0L) {
- onError(new IllegalArgumentException(
- "negative subscription request"));
- }
- }
-
- public final boolean isReleasable() { // for ManagedBlocker
- T item = putItem;
- if (item != null) {
- if ((putStat = offer(item)) == 0) {
- return false;
- }
- putItem = null;
- }
- return true;
- }
-
- public final boolean block() { // for ManagedBlocker
- T item = putItem;
- if (item != null) {
- putItem = null;
- long nanos = timeout;
- long deadline = (nanos > 0L) ? System.nanoTime() + nanos : 0L;
- while ((putStat = offer(item)) == 0) {
- if (Thread.interrupted()) {
- timeout = INTERRUPTED;
- if (nanos > 0L) {
- break;
- }
- } else if (nanos > 0L && (nanos = deadline - System.nanoTime()) <= 0L) {
- break;
- } else if (waiter == null) {
- waiter = Thread.currentThread();
- } else {
- if (nanos > 0L) {
- LockSupport.parkNanos(this, nanos);
- } else {
- LockSupport.park(this);
- }
- waiter = null;
- }
- }
- }
- waiter = null;
- return true;
- }
-
- /**
- * Consumer loop, called from ConsumerTask, or indirectly
- * when helping during submit.
- */
- final void consume() {
- Flow.Subscriber<? super T> s;
- int h = head;
- if ((s = subscriber) != null) { // else disabled
- for (;;) {
- long d = demand;
- int c;
- Object[] a;
- int n;
- long i;
- Object x;
- Thread w;
- if (((c = ctl) & (ERROR | SUBSCRIBE | DISABLED)) != 0) {
- if (!checkControl(s, c)) {
- break;
- }
- } else if ((a = array) == null || h == tail
- || (n = a.length) == 0
- || (x = U.getObjectVolatile(a, (i = ((long) ((n - 1) & h) << ASHIFT) + ABASE))) == null) {
- if (!checkEmpty(s, c)) {
- break;
- }
- } else if (d == 0L) {
- if (!checkDemand(c)) {
- break;
- }
- } else if (((c & CONSUME) != 0
- || U.compareAndSwapInt(this, CTL, c, c | CONSUME))
- && U.compareAndSwapObject(a, i, x, null)) {
- U.putOrderedInt(this, HEAD, ++h);
- U.getAndAddLong(this, DEMAND, -1L);
- if ((w = waiter) != null) {
- signalWaiter(w);
- }
- try {
- @SuppressWarnings("unchecked") T y = (T) x;
- s.onNext(y);
- } catch (Throwable ex) {
- handleOnNext(s, ex);
- }
- }
- }
- }
- }
-
- /**
- * Responds to control events in consume().
- */
- private boolean checkControl(Flow.Subscriber<? super T> s, int c) {
- boolean stat = true;
- if ((c & SUBSCRIBE) != 0) {
- if (U.compareAndSwapInt(this, CTL, c, c & ~SUBSCRIBE)) {
- try {
- if (s != null) {
- s.onSubscribe(this);
- }
- } catch (Throwable ex) {
- onError(ex);
- }
- }
- } else if ((c & ERROR) != 0) {
- Throwable ex = pendingError;
- ctl = DISABLED; // no need for CAS
- if (ex != null) { // null if errorless cancel
- try {
- if (s != null) {
- s.onError(ex);
- }
- } catch (Throwable ignore) {
- }
- }
- } else {
- detach();
- stat = false;
- }
- return stat;
- }
-
- /**
- * Responds to apparent emptiness in consume().
- */
- private boolean checkEmpty(Flow.Subscriber<? super T> s, int c) {
- boolean stat = true;
- if (head == tail) {
- if ((c & CONSUME) != 0) {
- U.compareAndSwapInt(this, CTL, c, c & ~CONSUME);
- } else if ((c & COMPLETE) != 0) {
- if (U.compareAndSwapInt(this, CTL, c, DISABLED)) {
- try {
- if (s != null) {
- s.onComplete();
- }
- } catch (Throwable ignore) {
- }
- }
- } else if (U.compareAndSwapInt(this, CTL, c, c & ~ACTIVE)) {
- stat = false;
- }
- }
- return stat;
- }
-
- /**
- * Responds to apparent zero demand in consume().
- */
- private boolean checkDemand(int c) {
- boolean stat = true;
- if (demand == 0L) {
- if ((c & CONSUME) != 0) {
- U.compareAndSwapInt(this, CTL, c, c & ~CONSUME);
- } else if (U.compareAndSwapInt(this, CTL, c, c & ~ACTIVE)) {
- stat = false;
- }
- }
- return stat;
- }
-
- /**
- * Processes exception in Subscriber.onNext.
- */
- private void handleOnNext(Flow.Subscriber<? super T> s, Throwable ex) {
- BiConsumer<? super Flow.Subscriber<? super T>, ? super Throwable> h;
- if ((h = onNextHandler) != null) {
- try {
- h.accept(s, ex);
- } catch (Throwable ignore) {
- }
- }
- onError(ex);
- }
-
- // Unsafe mechanics
- private static final sun.misc.Unsafe U = UnsafeAccessor.getUnsafe();
- private static final long CTL;
- private static final long TAIL;
- private static final long HEAD;
- private static final long DEMAND;
- private static final int ABASE;
- private static final int ASHIFT;
-
- static {
- try {
- CTL = U.objectFieldOffset(BufferedSubscription.class.getDeclaredField("ctl"));
- TAIL = U.objectFieldOffset(BufferedSubscription.class.getDeclaredField("tail"));
- HEAD = U.objectFieldOffset(BufferedSubscription.class.getDeclaredField("head"));
- DEMAND = U.objectFieldOffset(BufferedSubscription.class.getDeclaredField("demand"));
-
- ABASE = U.arrayBaseOffset(Object[].class);
- int scale = U.arrayIndexScale(Object[].class);
- if ((scale & (scale - 1)) != 0) {
- throw new Error("data type scale not a power of two");
- }
- ASHIFT = 31 - Integer.numberOfLeadingZeros(scale);
- } catch (ReflectiveOperationException e) {
- throw new Error(e);
- }
-
- // Reduce the risk of rare disastrous classloading in first call to
- // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
- Class<?> ensureLoaded = LockSupport.class;
- }
- }
-}
diff --git a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java b/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java
deleted file mode 100644
index 3729469..0000000
--- a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/SubmissionPublisherFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.internal.jsr166;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.ForkJoinPool;
-import java.util.function.BiConsumer;
-
-/**
- * Factory creating JDK8 compatible SubmissionPublisher (Jdk8SubmissionPublisher) or JDK 9+ SubmissionPublisher
- */
-public class SubmissionPublisherFactory {
-
- /**
- * Creates a new SubmissionPublisher using the {@link
- * ForkJoinPool#commonPool()} for async delivery to subscribers
- * (unless it does not support a parallelism level of at least two,
- * in which case, a new Thread is created to run each task), with
- * maximum buffer capacity of {@link Flow#defaultBufferSize}, and no
- * handler for Subscriber exceptions in method {@link
- * Flow.Subscriber#onNext(Object) onNext}.
- */
- public static <T> SubmittableFlowPublisher<T> createSubmissionPublisher() {
- return new SubmissionPublisher<T>();
- }
-
- public static <T> SubmittableFlowPublisher<T> createSubmissionPublisher(Executor executor,
- int maxBufferCapacity) {
- return new SubmissionPublisher<T>(executor, maxBufferCapacity);
- }
-
- public static <T> SubmittableFlowPublisher<T> createSubmissionPublisher(Executor executor,
- int maxBufferCapacity,
- BiConsumer<? super Flow.Subscriber<? super T>,
- ? super Throwable> handler) {
- return new SubmissionPublisher<T>(executor, maxBufferCapacity, handler);
- }
-
-}
diff --git a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/UnsafeAccessor.java b/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/UnsafeAccessor.java
deleted file mode 100644
index 19f9887..0000000
--- a/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166/UnsafeAccessor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.internal.jsr166;
-
-import sun.misc.Unsafe;
-
-import java.lang.reflect.Field;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * Helper for classes in the jsr166 package to access the {@code sun.misc.Unsafe} instance.
- *
- * @author Adam Lindenthal
- */
-class UnsafeAccessor {
- static sun.misc.Unsafe getUnsafe() {
- try {
- return sun.misc.Unsafe.getUnsafe();
- } catch (SecurityException tryReflectionInstead) {
- }
- try {
- return java.security.AccessController.doPrivileged((PrivilegedExceptionAction<Unsafe>) () -> {
- Class<Unsafe> k = Unsafe.class;
- for (Field f : k.getDeclaredFields()) {
- f.setAccessible(true);
- Object x = f.get(null);
- if (k.isInstance(x)) {
- return k.cast(x);
- }
- }
- throw new NoSuchFieldError("the Unsafe");
- });
- } catch (java.security.PrivilegedActionException e) {
- throw new RuntimeException("Could not initialize intrinsics", e.getCause());
- }
-
-
- }
-}
diff --git a/etc/config/copyright-exclude b/etc/config/copyright-exclude
index 987175b..d5cff67 100644
--- a/etc/config/copyright-exclude
+++ b/etc/config/copyright-exclude
@@ -71,8 +71,6 @@
/tests/e2e-entity/src/test/resources/org/glassfish/jersey/tests/e2e/entity/xxe.txt
/core-server/src/main/java/com/sun/research/ws/wadl
/core-common/src/main/java/org/glassfish/jersey/internal/jsr166
-/core-common/src/main/jsr166/org/glassfish/jersey/internal/jsr166
-/core-common/src/main/java8/org/glassfish/jersey/internal/jsr166
/tests/performance/etc/data/MEASUREMENT_DATA
/core-common/src/main/java/org/glassfish/jersey/internal/guava/
/core-server/src/main/java/org/glassfish/jersey/server/internal/monitoring/core/AbstractSlidingWindowTimeReservoir.java
diff --git a/examples/bookstore-webapp/pom.xml b/examples/bookstore-webapp/pom.xml
index 20f9774..4d5ff1d 100644
--- a/examples/bookstore-webapp/pom.xml
+++ b/examples/bookstore-webapp/pom.xml
@@ -69,6 +69,11 @@
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-osgi</artifactId>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
<build>
@@ -88,19 +93,6 @@
<profiles>
<profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-osgi</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </profile>
- <profile>
<!-- mvn test -Prun-external-tests -->
<id>run-external-tests</id>
<build>
diff --git a/examples/https-clientserver-grizzly/pom.xml b/examples/https-clientserver-grizzly/pom.xml
index 9a68afc..fac2e4b 100644
--- a/examples/https-clientserver-grizzly/pom.xml
+++ b/examples/https-clientserver-grizzly/pom.xml
@@ -58,6 +58,12 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-osgi</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
</dependencies>
<build>
@@ -74,23 +80,6 @@
<profiles>
<profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <properties>
- <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
- <surefire.security.argline>-Djdk.tls.server.protocols=TLSv1.2</surefire.security.argline>
- </properties>
- <dependencies>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-osgi</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </profile>
- <profile>
<id>pre-release</id>
<build>
<plugins>
@@ -103,4 +92,9 @@
</profile>
</profiles>
+ <properties>
+ <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
+ <surefire.security.argline>-Djdk.tls.server.protocols=TLSv1.2</surefire.security.argline>
+ </properties>
+
</project>
diff --git a/ext/microprofile/mp-config/pom.xml b/ext/microprofile/mp-config/pom.xml
index eebc242..7ae3aac 100644
--- a/ext/microprofile/mp-config/pom.xml
+++ b/ext/microprofile/mp-config/pom.xml
@@ -75,42 +75,13 @@
<scope>test</scope>
</dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+ <artifactId>jersey-test-framework-provider-jetty</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
- <profiles>
- <profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/microprofile/config/ExternalPropertiesConfigurationFactoryTest.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>Jetty11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.glassfish.jersey.test-framework.providers</groupId>
- <artifactId>jersey-test-framework-provider-jetty</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
+ </dependencies>
</project>
diff --git a/ext/pom.xml b/ext/pom.xml
index 83b3061..c4f3784 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -55,7 +55,7 @@
<module>spring4</module>
<module>spring5</module>
-->
-<!-- <module>wadl-doclet</module> temporarily exclude until 4812 gets merged into this branch -->
+ <module>wadl-doclet</module>
<module>microprofile</module>
</modules>
diff --git a/incubator/declarative-linking/pom.xml b/incubator/declarative-linking/pom.xml
index 0fa4aa0..f4ac12f 100644
--- a/incubator/declarative-linking/pom.xml
+++ b/incubator/declarative-linking/pom.xml
@@ -79,12 +79,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
-<!-- <dependency>-->
-<!-- <groupId>org.glassfish.jersey.media</groupId>-->
-<!-- <artifactId>jersey-media-json-jackson</artifactId>-->
-<!-- <version>${jersey.version}</version>-->
-<!-- <scope>test</scope>-->
-<!-- </dependency>-->
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ <version>${jersey.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
@@ -179,22 +179,6 @@
</execution>
</executions>
</plugin>
- <plugin>
- <!-- TODO remove after jakartification -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>default-test</id> <!-- jakartification-excluded-tests -->
- <configuration>
- <excludes>
- <exclude>org/glassfish/jersey/linking/integration/LinkingTest.java</exclude>
- <exclude>org/glassfish/jersey/linking/integration/LinkingManualTest.java</exclude>
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</project>
diff --git a/media/multipart/pom.xml b/media/multipart/pom.xml
index b4f2a65..612fe64 100644
--- a/media/multipart/pom.xml
+++ b/media/multipart/pom.xml
@@ -92,6 +92,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.connectors</groupId>
+ <artifactId>jersey-jetty-connector</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
@@ -99,40 +105,4 @@
</dependency>
</dependencies>
- <profiles>
- <profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/media/multipart/internal/MultiPartHeaderModificationTest.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>Jetty11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.glassfish.jersey.connectors</groupId>
- <artifactId>jersey-jetty-connector</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
</project>
diff --git a/pom.xml b/pom.xml
index d67cdca..b046691 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.eclipse.ee4j</groupId>
<artifactId>project</artifactId>
- <version>1.0.6</version>
+ <version>1.0.7</version>
</parent>
<groupId>org.glassfish.jersey</groupId>
diff --git a/test-framework/providers/jetty/pom.xml b/test-framework/providers/jetty/pom.xml
index 5436e9b..fa2539f 100644
--- a/test-framework/providers/jetty/pom.xml
+++ b/test-framework/providers/jetty/pom.xml
@@ -44,148 +44,4 @@
</dependency>
</dependencies>
- <properties>
- <java8.build.outputDirectory>${project.basedir}/target</java8.build.outputDirectory>
- <java8.sourceDirectory>${project.basedir}/src/main/java8</java8.sourceDirectory>
- <java11.build.outputDirectory>${project.basedir}/target11</java11.build.outputDirectory>
- <java11.sourceDirectory>${project.basedir}/src/main/java11</java11.sourceDirectory>
- </properties>
-
- <profiles>
- <profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <directory>${java8.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java8.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/test/jetty/*.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>Jetty11</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <build>
- <directory>${java11.build.outputDirectory}</directory>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${java11.sourceDirectory}</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>copyJDK11FilesToMultiReleaseJar</id>
- <activation>
- <file>
- <!-- ${java11.build.outputDirectory} does not work here -->
- <exists>target11/classes/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.class</exists>
- </file>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <inherited>true</inherited>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Multi-Release>true</Multi-Release>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>copy-jdk11-classes</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>copy-resources</goal>
- </goals>
- <configuration>
- <outputDirectory>${java8.build.outputDirectory}/classes/META-INF/versions/11</outputDirectory>
- <resources>
- <resource>
- <directory>${java11.build.outputDirectory}/classes</directory>
- </resource>
- </resources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-jdk11-sources</id>
- <phase>package</phase>
- <configuration>
- <target>
- <property name="sources-jar" value="${java8.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
- <echo>sources-jar: ${sources-jar}</echo>
- <zip destfile="${sources-jar}" update="true">
- <zipfileset dir="${java11.sourceDirectory}" prefix="META-INF/versions/11"/>
- </zip>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>
diff --git a/test-framework/providers/jetty/src/main/java11/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java b/test-framework/providers/jetty/src/main/java/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
similarity index 98%
rename from test-framework/providers/jetty/src/main/java11/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
rename to test-framework/providers/jetty/src/main/java/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
index e5dba36..2ce4577 100644
--- a/test-framework/providers/jetty/src/main/java11/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
+++ b/test-framework/providers/jetty/src/main/java/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
diff --git a/test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java b/test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
deleted file mode 100644
index cd2e332..0000000
--- a/test-framework/providers/jetty/src/main/java8/org/glassfish/jersey/test/jetty/JettyTestContainerFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0, which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * This Source Code may also be made available under the following Secondary
- * Licenses when the conditions for such availability set forth in the
- * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
- * version 2 with the GNU Classpath Exception, which is available at
- * https://www.gnu.org/software/classpath/license.html.
- *
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
- */
-
-package org.glassfish.jersey.test.jetty;
-
-import jakarta.ws.rs.ProcessingException;
-import org.glassfish.jersey.jetty.internal.LocalizationMessages;
-import org.glassfish.jersey.test.DeploymentContext;
-import org.glassfish.jersey.test.spi.TestContainer;
-import org.glassfish.jersey.test.spi.TestContainerFactory;
-
-import java.net.URI;
-
-/**
- * Jetty test factory stub for JDK 1.8 only
- *
- * since Jetty 11+ does not support JDKs below 11
- */
-public class JettyTestContainerFactory implements TestContainerFactory {
-
- @Override
- public TestContainer create(final URI baseUri, final DeploymentContext context) throws IllegalArgumentException {
- throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
- }
-}
diff --git a/tests/e2e-client/pom.xml b/tests/e2e-client/pom.xml
index 55e95d3..5677395 100644
--- a/tests/e2e-client/pom.xml
+++ b/tests/e2e-client/pom.xml
@@ -188,16 +188,6 @@
<profiles>
<profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <properties>
- <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
- <surefire.security.argline>-Djdk.tls.server.protocols=TLSv1.2</surefire.security.argline>
- </properties>
- </profile>
- <profile>
<id>xdk</id>
<properties>
<!-- do not use security manager for xdk -->
@@ -224,4 +214,9 @@
</profile>
</profiles>
+ <properties>
+ <!-- https://bugs.openjdk.java.net/browse/JDK-8211426 -->
+ <surefire.security.argline>-Djdk.tls.server.protocols=TLSv1.2</surefire.security.argline>
+ </properties>
+
</project>
diff --git a/tests/e2e/pom.xml b/tests/e2e/pom.xml
index 179e28b..9638cec 100644
--- a/tests/e2e/pom.xml
+++ b/tests/e2e/pom.xml
@@ -205,26 +205,6 @@
</properties>
</profile>
<profile>
- <id>JettyExclude</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <testExcludes>
- <testExclude>org/glassfish/jersey/tests/e2e/container/Jersey2462Test.java</testExclude>
- <testExclude>org/glassfish/jersey/tests/e2e/container/JettyEmptyHeaderParamTest.java</testExclude>
- </testExcludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
<id>sonar</id>
<build>
<pluginManagement>
diff --git a/tests/integration/j-59/war/pom.xml b/tests/integration/j-59/war/pom.xml
index 5743c61..f6268bf 100644
--- a/tests/integration/j-59/war/pom.xml
+++ b/tests/integration/j-59/war/pom.xml
@@ -65,6 +65,11 @@
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>jakarta.jws</groupId>
+ <artifactId>jakarta.jws-api</artifactId>
+ <version>1.1.1</version>
+ </dependency>
</dependencies>
<build>
@@ -96,22 +101,6 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>jakarta.jws</groupId>
- <artifactId>jakarta.jws-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<skipTests>true</skipTests>
diff --git a/tests/integration/jersey-2322/pom.xml b/tests/integration/jersey-2322/pom.xml
index 5b8de17..428248f 100644
--- a/tests/integration/jersey-2322/pom.xml
+++ b/tests/integration/jersey-2322/pom.xml
@@ -58,14 +58,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/*</exclude>
- </excludes>
- <testExcludes>
- <testExclude>**/*</testExclude>
- </testExcludes>
- </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/tests/integration/servlet-4.0-mvc-1/pom.xml b/tests/integration/servlet-4.0-mvc-1/pom.xml
index 23106f2..5094b90 100644
--- a/tests/integration/servlet-4.0-mvc-1/pom.xml
+++ b/tests/integration/servlet-4.0-mvc-1/pom.xml
@@ -51,6 +51,14 @@
<artifactId>jakarta.servlet-api</artifactId>
<version>${servlet5.version}</version>
</dependency>
+ <dependency>
+ <groupId>jakarta.xml.bind</groupId>
+ <artifactId>jakarta.xml.bind-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-osgi</artifactId>
+ </dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
@@ -91,24 +99,4 @@
</plugin>
</plugins>
</build>
-
- <profiles>
- <profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-osgi</artifactId>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
</project>
diff --git a/tests/performance/test-cases/mbw-xml-jaxb/pom.xml b/tests/performance/test-cases/mbw-xml-jaxb/pom.xml
index 9620115..4d287f7 100644
--- a/tests/performance/test-cases/mbw-xml-jaxb/pom.xml
+++ b/tests/performance/test-cases/mbw-xml-jaxb/pom.xml
@@ -46,6 +46,11 @@
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-osgi</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
@@ -63,42 +68,4 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>jdk11+</id>
- <activation>
- <jdk>[11,)</jdk>
- </activation>
- <dependencies>
- <dependency>
- <groupId>jakarta.xml.bind</groupId>
- <artifactId>jakarta.xml.bind-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-osgi</artifactId>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>jdk8</id>
- <activation>
- <jdk>1.8</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>org/glassfish/jersey/tests/performance/mbw/xml/XmlEntityTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
</project>