From df98ef761d0f89f6b3251bc806012462eae6b30f Mon Sep 17 00:00:00 2001 From: Shautvast Date: Mon, 1 Jul 2024 12:54:59 +0200 Subject: [PATCH] comments --- .../java/com/github/shautvast/exceptional/ExceptionLogger.java | 1 + .../com/github/shautvast/exceptional/MPSCBufferWriter.java | 2 +- .../com/github/shautvast/exceptional/ExceptionLoggerTest.java | 2 +- rustlib/src/lib.rs | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java b/lib/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java index 27b9d74..a1a92ff 100644 --- a/lib/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java +++ b/lib/src/main/java/com/github/shautvast/exceptional/ExceptionLogger.java @@ -10,6 +10,7 @@ public class ExceptionLogger { public static void log(Throwable throwable) { try { // use json for now because of ease of integration + // would compression be useful?? use snappy? if (throwable != null) { bufferWriter.put(objectMapper.writeValueAsBytes(throwable)); } diff --git a/lib/src/main/java/com/github/shautvast/exceptional/MPSCBufferWriter.java b/lib/src/main/java/com/github/shautvast/exceptional/MPSCBufferWriter.java index 62bf167..b8d15ba 100644 --- a/lib/src/main/java/com/github/shautvast/exceptional/MPSCBufferWriter.java +++ b/lib/src/main/java/com/github/shautvast/exceptional/MPSCBufferWriter.java @@ -29,7 +29,7 @@ public class MPSCBufferWriter implements AutoCloseable { // setup of native memory ringbuffer var arena = Arena.ofConfined(); - var ringbufferMemory = arena.allocate(0xffff); + var ringbufferMemory = arena.allocate(32768); var buffer = new CircularByteBuffer(ringbufferMemory); arena = Arena.ofConfined(); diff --git a/lib/src/test/java/com/github/shautvast/exceptional/ExceptionLoggerTest.java b/lib/src/test/java/com/github/shautvast/exceptional/ExceptionLoggerTest.java index b5f4e2b..fd884b5 100644 --- a/lib/src/test/java/com/github/shautvast/exceptional/ExceptionLoggerTest.java +++ b/lib/src/test/java/com/github/shautvast/exceptional/ExceptionLoggerTest.java @@ -9,7 +9,7 @@ class ExceptionLoggerTest { @Test void test() throws InterruptedException { ExceptionLogger.log(new Throwable()); - TimeUnit.SECONDS.sleep(30); + TimeUnit.SECONDS.sleep(1); } } \ No newline at end of file diff --git a/rustlib/src/lib.rs b/rustlib/src/lib.rs index 2dced31..1d17dcf 100644 --- a/rustlib/src/lib.rs +++ b/rustlib/src/lib.rs @@ -2,6 +2,9 @@ use std::ffi::c_char; mod throwable; +// same value, but different meanings +// TODO find a way to set the buffer size from java. +// why not just add it to the function const CAPACITY: isize = 32760; const READ: isize = 32760;