Skip to content

Commit

Permalink
Update JAppReader
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Aug 15, 2024
1 parent 6408924 commit 83a4f24
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion boot/src/main/java/org/glavo/japp/boot/JAppReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

public final class JAppReader implements DecompressContext, Closeable {
private static final int MAX_ARRAY_LENGTH = Integer.MAX_VALUE - 8;
private static final int READ_ALL_THRESHOLD = 16 * 1024 * 1024;

private static JAppReader systemReader;

Expand All @@ -66,7 +67,7 @@ public static JAppBootArgs openSystemReader(ByteBuffer bootArgs) throws IOExcept
JAppBootMetadata metadata = JAppBootMetadata.readFrom(metadataBuffer, decompressor);

ByteBuffer mappedBuffer = null;
if (metadataOffset < 16 * 1024 * 1024) { // TODO: Configurable threshold
if (metadataOffset < READ_ALL_THRESHOLD) {
mappedBuffer = ByteBuffer.allocateDirect((int) metadataOffset);
IOUtils.readFully(channel.position(baseOffset), mappedBuffer);
mappedBuffer.flip();
Expand Down

0 comments on commit 83a4f24

Please sign in to comment.