This commit is contained in:
Shautvast 2024-07-01 12:54:59 +02:00
parent de7381ac31
commit df98ef761d
4 changed files with 6 additions and 2 deletions

View file

@ -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));
}

View file

@ -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();

View file

@ -9,7 +9,7 @@ class ExceptionLoggerTest {
@Test
void test() throws InterruptedException {
ExceptionLogger.log(new Throwable());
TimeUnit.SECONDS.sleep(30);
TimeUnit.SECONDS.sleep(1);
}
}

View file

@ -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;