|
30 | 30 |
|
31 | 31 | import java.io.File; |
32 | 32 | import java.io.IOException; |
| 33 | +import java.lang.foreign.Arena; |
33 | 34 | import java.lang.foreign.MemorySegment; |
34 | 35 | import java.lang.foreign.MemorySession; |
35 | 36 | import java.nio.ByteBuffer; |
@@ -61,21 +62,21 @@ public class MapToMemorySegmentTest { |
61 | 62 |
|
62 | 63 | @Test(expectedExceptions = UnsupportedOperationException.class) |
63 | 64 | public void testCustomFileChannel() throws IOException { |
64 | | - var session = MemorySession.openConfined(); |
| 65 | + var arena = Arena.openConfined(); |
65 | 66 | var fc = FileChannel.open(tempPath, StandardOpenOption.WRITE, StandardOpenOption.READ); |
66 | 67 | var fileChannel = new CustomFileChannel(fc); |
67 | | - try (session; fileChannel){ |
68 | | - fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, session); |
| 68 | + try (arena; fileChannel){ |
| 69 | + fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, arena.session()); |
69 | 70 | } |
70 | 71 | } |
71 | 72 |
|
72 | 73 | @Test |
73 | 74 | public void testCustomFileChannelOverride() throws IOException { |
74 | | - var session = MemorySession.openConfined(); |
| 75 | + var arena = Arena.openConfined(); |
75 | 76 | var fc = FileChannel.open(tempPath, StandardOpenOption.WRITE, StandardOpenOption.READ); |
76 | 77 | var fileChannel = new CustomFileChannelOverride(fc); |
77 | | - try (session; fileChannel){ |
78 | | - fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, session); |
| 78 | + try (arena; fileChannel){ |
| 79 | + fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, arena.session()); |
79 | 80 | } |
80 | 81 | } |
81 | 82 |
|
|
0 commit comments