Skip to content

Commit

Permalink
jdk 21
Browse files Browse the repository at this point in the history
  • Loading branch information
lilianalillyy committed Jan 9, 2025
1 parent f1d01da commit b776ae3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
29 changes: 25 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
<version>3.0.3-jdk20</version>
<version>3.0.4-jdk21</version>
<packaging>bundle</packaging>

<description>A fast java serialization drop in-replacement and some serialization based utils such as Structs and OffHeap Memory.</description>
Expand Down Expand Up @@ -47,8 +47,8 @@
<debuglevel>lines,vars,source</debuglevel> <!-- required to make structs work -->
<optimize>false</optimize>
<verbose>true</verbose>
<source>20</source>
<target>20</target>
<source>21</source>
<target>21</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>--enable-preview</arg>
Expand Down Expand Up @@ -86,7 +86,7 @@
<additionalJOptions>
<additionalJOption>--enable-preview</additionalJOption>
<additionalJOption>--release</additionalJOption>
<additionalJOption>20</additionalJOption>
<additionalJOption>21</additionalJOption>
</additionalJOptions>
</configuration>
<executions>
Expand Down Expand Up @@ -128,9 +128,30 @@
</configuration>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nxrm3-maven-plugin</artifactId>
<version>1.0.7</version>
<extensions>true</extensions>
<configuration>
<nexusUrl>https://nexus.coolpany.net</nexusUrl>
<serverId>coolpany</serverId>
<repository>maven-releases</repository>
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>

</plugins>
</build>

<distributionManagement>
<repository>
<id>coolpany</id>
<url>https://nexus.coolpany.net/repository/maven-releases</url>
</repository>
</distributionManagement>


<dependencies>

<!-- required for createJSONConfiguration -->
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/nustaq/offheap/bytez/malloc/MMFBytez.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.io.RandomAccessFile;

import java.io.File;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.Arena;
import java.nio.channels.FileChannel;

/**
Expand All @@ -28,7 +28,7 @@
*/
public class MMFBytez extends MemoryBytez {
private File file;
private SegmentScope scope;
private Arena scope;

public MMFBytez(String filePath, long length, boolean clearFile) throws Exception {
init(filePath, length, clearFile);
Expand All @@ -44,7 +44,7 @@ protected void init(String file, long length, boolean clearFile) throws Exceptio
f.createNewFile();
}

scope = SegmentScope.auto();
scope = Arena.ofAuto();
memseg = new RandomAccessFile(f, "rw").getChannel().map(FileChannel.MapMode.READ_WRITE, 0, length, scope);
/// memseg = MemorySegment.mapFile(f.toPath(), 0, length, FileChannel.MapMode.READ_WRITE, scope);
this.file = f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import org.nustaq.offheap.bytez.BasicBytez;
import org.nustaq.offheap.bytez.Bytez;

import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;

/**
* Date: 17.11.13
* Time: 00:01
Expand All @@ -37,7 +34,9 @@ public class MemoryBytez implements Bytez {
protected MemoryBytez() {}

public MemoryBytez(long len) {
memseg = MemorySegment.allocateNative(len, SegmentScope.auto());
try (Arena arena = Arena.ofConfined()) {
memseg = arena.allocate(len);
}
}

public MemoryBytez(MemorySegment mem) {
Expand Down

0 comments on commit b776ae3

Please sign in to comment.