Skip to content

Commit

Permalink
Updating to support Java 11
Browse files Browse the repository at this point in the history
 * Using ByteBufferPool instead of ByteBufferSlicePool.
 * Creating a profile for Java > 8 with BC as a dependency for
   certificate creation and an updated version of jboss logging.

Signed-off-by: Emmanuel Hugonnet <[email protected]>
  • Loading branch information
ehsavoie committed Jan 4, 2024
1 parent 451f1c1 commit fef7348
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 52 deletions.
141 changes: 98 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,36 @@
<packaging>jar</packaging>

<organization>
<name>JBoss, a division of Red Hat</name>
<url>http://www.jboss.org/</url>
<name>JBoss, a division of Red Hat</name>
<url>http://www.jboss.org/</url>
</organization>

<licenses>
<license>
<name>ASL 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
<license>
<name>ASL 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/xnio/netty-xnio-transport.git</connection>
<developerConnection>scm:git:https://github.com/xnio/netty-xnio-transport.git</developerConnection>
<url>https://github.com/xnio/netty-xnio-transport</url>
<connection>scm:git:git://github.com/xnio/netty-xnio-transport.git</connection>
<developerConnection>scm:git:https://github.com/xnio/netty-xnio-transport.git</developerConnection>
<url>https://github.com/xnio/netty-xnio-transport</url>
<tag>HEAD</tag>
</scm>

<distributionManagement>
<repository>
<id>jboss-releases-repository</id>
<name>JBoss Releases Repository</name>
<url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>jboss-snapshots-repository</id>
<name>JBoss Snapshots Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>jboss-releases-repository</id>
<name>JBoss Releases Repository</name>
<url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>jboss-snapshots-repository</id>
<name>JBoss Snapshots Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>

<prerequisites>
Expand Down Expand Up @@ -99,6 +99,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.3</version>
</plugin>
</plugins>
</build>

Expand All @@ -125,25 +130,25 @@
<!--<type>test-jar</type> -->
<scope>test</scope>
</dependency>
<!-- Common test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Common test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-nio</artifactId>
Expand All @@ -166,6 +171,56 @@
<junit.version>5.9.0</junit.version>
</properties>

<profiles>
<profile>
<id>java11</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<properties>
<jboss.logging.version>3.5.3.Final</jboss.logging.version>
<org.bouncycastle.version>1.70</org.bouncycastle.version>
</properties>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${org.bouncycastle.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine> --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[11,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
<repository>
Expand All @@ -191,10 +246,10 @@
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
5 changes: 3 additions & 2 deletions src/main/java/org/xnio/netty/buffer/XnioByteBufAllocator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.netty.buffer.AbstractByteBufAllocator;
import io.netty.buffer.ByteBuf;
import io.netty.util.internal.PlatformDependent;
import org.xnio.ByteBufferPool;
import org.xnio.ByteBufferSlicePool;

/**
Expand All @@ -28,9 +29,9 @@
* @author <a href="mailto:[email protected]">Norman Maurer</a>
*/
public final class XnioByteBufAllocator extends AbstractByteBufAllocator {
final ByteBufferSlicePool pool;
final ByteBufferPool pool;

public XnioByteBufAllocator(ByteBufferSlicePool pool) {
public XnioByteBufAllocator(ByteBufferPool pool) {
if (pool == null) {
throw new NullPointerException("pool");
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/xnio/netty/buffer/XnioByteBufUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package org.xnio.netty.buffer;

import io.netty.util.internal.PlatformDependent;
import org.xnio.ByteBufferSlicePool;
import org.xnio.Pooled;

import java.nio.ByteBuffer;
import org.xnio.ByteBufferPool;

/**
* @author <a href="mailto:[email protected]">Norman Maurer</a>
Expand All @@ -31,10 +31,10 @@ private XnioByteBufUtil() {
// Utility
}

static Pooled<ByteBuffer> allocateDirect(ByteBufferSlicePool pool, int initialCapacity) {
static Pooled<ByteBuffer> allocateDirect(ByteBufferPool pool, int initialCapacity) {
Pooled<ByteBuffer> pooled;
if (initialCapacity <= pool.getBufferSize()) {
pooled = pool.allocate();
if (initialCapacity <= pool.getSize()) {
pooled = new PooledByteBuf(pool.allocate());
} else {
pooled = new PooledByteBuf(ByteBuffer.allocateDirect(initialCapacity));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.EventLoopGroup;
import io.netty.testsuite.transport.TestsuitePermutation;
import org.xnio.ByteBufferSlicePool;
import org.xnio.netty.buffer.XnioByteBufAllocator;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.xnio.ByteBufferPool;

/**
*
Expand All @@ -45,8 +45,8 @@ final class XnioTestsuiteUtils {
}

static List<ByteBufAllocator> newAllocators(List<ByteBufAllocator> allocs) {
List<ByteBufAllocator> allocators = new ArrayList<ByteBufAllocator>(allocs);
allocators.add(new XnioByteBufAllocator(new ByteBufferSlicePool(1024 * 16, 1024 * 32)));
List<ByteBufAllocator> allocators = new ArrayList<>(allocs);
allocators.add(new XnioByteBufAllocator(ByteBufferPool.LARGE_DIRECT));
return allocators;
}

Expand Down

0 comments on commit fef7348

Please sign in to comment.