Skip to content

Commit b776ae3

Browse files
committed
jdk 21
1 parent f1d01da commit b776ae3

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

pom.xml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111
<groupId>de.ruedigermoeller</groupId>
1212
<artifactId>fst</artifactId>
13-
<version>3.0.3-jdk20</version>
13+
<version>3.0.4-jdk21</version>
1414
<packaging>bundle</packaging>
1515

1616
<description>A fast java serialization drop in-replacement and some serialization based utils such as Structs and OffHeap Memory.</description>
@@ -47,8 +47,8 @@
4747
<debuglevel>lines,vars,source</debuglevel> <!-- required to make structs work -->
4848
<optimize>false</optimize>
4949
<verbose>true</verbose>
50-
<source>20</source>
51-
<target>20</target>
50+
<source>21</source>
51+
<target>21</target>
5252
<encoding>UTF-8</encoding>
5353
<compilerArgs>
5454
<arg>--enable-preview</arg>
@@ -86,7 +86,7 @@
8686
<additionalJOptions>
8787
<additionalJOption>--enable-preview</additionalJOption>
8888
<additionalJOption>--release</additionalJOption>
89-
<additionalJOption>20</additionalJOption>
89+
<additionalJOption>21</additionalJOption>
9090
</additionalJOptions>
9191
</configuration>
9292
<executions>
@@ -128,9 +128,30 @@
128128
</configuration>
129129
</plugin>
130130

131+
<plugin>
132+
<groupId>org.sonatype.plugins</groupId>
133+
<artifactId>nxrm3-maven-plugin</artifactId>
134+
<version>1.0.7</version>
135+
<extensions>true</extensions>
136+
<configuration>
137+
<nexusUrl>https://nexus.coolpany.net</nexusUrl>
138+
<serverId>coolpany</serverId>
139+
<repository>maven-releases</repository>
140+
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
141+
</configuration>
142+
</plugin>
143+
131144
</plugins>
132145
</build>
133146

147+
<distributionManagement>
148+
<repository>
149+
<id>coolpany</id>
150+
<url>https://nexus.coolpany.net/repository/maven-releases</url>
151+
</repository>
152+
</distributionManagement>
153+
154+
134155
<dependencies>
135156

136157
<!-- required for createJSONConfiguration -->

src/main/java/org/nustaq/offheap/bytez/malloc/MMFBytez.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import java.io.RandomAccessFile;
2020

2121
import java.io.File;
22-
import java.lang.foreign.SegmentScope;
22+
import java.lang.foreign.Arena;
2323
import java.nio.channels.FileChannel;
2424

2525
/**
@@ -28,7 +28,7 @@
2828
*/
2929
public class MMFBytez extends MemoryBytez {
3030
private File file;
31-
private SegmentScope scope;
31+
private Arena scope;
3232

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

47-
scope = SegmentScope.auto();
47+
scope = Arena.ofAuto();
4848
memseg = new RandomAccessFile(f, "rw").getChannel().map(FileChannel.MapMode.READ_WRITE, 0, length, scope);
4949
/// memseg = MemorySegment.mapFile(f.toPath(), 0, length, FileChannel.MapMode.READ_WRITE, scope);
5050
this.file = f;

src/main/java/org/nustaq/offheap/bytez/malloc/MemoryBytez.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
import org.nustaq.offheap.bytez.BasicBytez;
2121
import org.nustaq.offheap.bytez.Bytez;
2222

23-
import java.lang.invoke.VarHandle;
24-
import java.nio.ByteOrder;
25-
2623
/**
2724
* Date: 17.11.13
2825
* Time: 00:01
@@ -37,7 +34,9 @@ public class MemoryBytez implements Bytez {
3734
protected MemoryBytez() {}
3835

3936
public MemoryBytez(long len) {
40-
memseg = MemorySegment.allocateNative(len, SegmentScope.auto());
37+
try (Arena arena = Arena.ofConfined()) {
38+
memseg = arena.allocate(len);
39+
}
4140
}
4241

4342
public MemoryBytez(MemorySegment mem) {

0 commit comments

Comments
 (0)