diff --git a/scripts/benchmark.bat b/scripts/benchmark.bat index d187dce..e8603cc 100644 --- a/scripts/benchmark.bat +++ b/scripts/benchmark.bat @@ -52,5 +52,5 @@ timeout /t 2 echo. echo Benchmarking... -java -cp ./src/tigerbeetle-java/target/classes Benchmark +java -cp ./src/tigerbeetle-java/target/classes benchmark/Benchmark exit /b %errorlevel% diff --git a/scripts/benchmark.sh b/scripts/benchmark.sh index 33ed8fa..e443cea 100755 --- a/scripts/benchmark.sh +++ b/scripts/benchmark.sh @@ -56,7 +56,7 @@ sleep 1 echo "" echo "Benchmarking..." -java -cp ./src/tigerbeetle-java/target/classes Benchmark +java -cp ./src/tigerbeetle-java/target/classes benchmark/Benchmark echo "" for I in 0 diff --git a/src/tigerbeetle-java/pom.xml b/src/tigerbeetle-java/pom.xml index 097d596..0292b48 100644 --- a/src/tigerbeetle-java/pom.xml +++ b/src/tigerbeetle-java/pom.xml @@ -110,7 +110,7 @@ com/tigerbeetle/JNILoader$Arch.class - Benchmark.class + benchmark/Benchmark.class diff --git a/src/tigerbeetle-java/src/main/java/Benchmark.java b/src/tigerbeetle-java/src/main/java/benchmark/Benchmark.java similarity index 99% rename from src/tigerbeetle-java/src/main/java/Benchmark.java rename to src/tigerbeetle-java/src/main/java/benchmark/Benchmark.java index c330872..b126f12 100644 --- a/src/tigerbeetle-java/src/main/java/Benchmark.java +++ b/src/tigerbeetle-java/src/main/java/benchmark/Benchmark.java @@ -1,10 +1,12 @@ +package benchmark; + import java.util.concurrent.CompletableFuture; import com.tigerbeetle.*; public class Benchmark { public static void main(String[] args) { - try (var client = new Client(0, new String[] {"127.0.0.1:3001"}, 32)) { + try (var client = new Client(0, new String[] {"127.0.0.1:3001"})) { var accounts = new AccountBatch(2); diff --git a/src/tigerbeetle-java/src/main/java/com/tigerbeetle/package-info.java b/src/tigerbeetle-java/src/main/java/com/tigerbeetle/package-info.java new file mode 100644 index 0000000..bfd50d4 --- /dev/null +++ b/src/tigerbeetle-java/src/main/java/com/tigerbeetle/package-info.java @@ -0,0 +1,7 @@ +/** + * TigerBeetle client for Java. + * + * @see TigerBeetle Docs + * @see Source code + */ +package com.tigerbeetle; diff --git a/src/tigerbeetle-java/src/main/java/module-info.java b/src/tigerbeetle-java/src/main/java/module-info.java new file mode 100644 index 0000000..f5ae202 --- /dev/null +++ b/src/tigerbeetle-java/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module com.tigerbeetle { + exports com.tigerbeetle; +} \ No newline at end of file diff --git a/src/tigerbeetle-java/src/test/java/com/tigerbeetle/IntegrationTest.java b/src/tigerbeetle-java/src/test/java/com/tigerbeetle/IntegrationTest.java index 342e2bb..d2b6c86 100644 --- a/src/tigerbeetle-java/src/test/java/com/tigerbeetle/IntegrationTest.java +++ b/src/tigerbeetle-java/src/test/java/com/tigerbeetle/IntegrationTest.java @@ -10,7 +10,6 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import javax.management.OperationsException; import org.junit.Test; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -1139,7 +1138,7 @@ private static class Server implements AutoCloseable { private Process process; - public Server() throws IOException, OperationsException, InterruptedException { + public Server() throws IOException, Exception, InterruptedException { cleanUp(); @@ -1158,13 +1157,13 @@ public Server() throws IOException, OperationsException, InterruptedException { if (format.waitFor() != 0) { var reader = new BufferedReader(new InputStreamReader(format.getErrorStream())); var error = reader.lines().collect(Collectors.joining(". ")); - throw new OperationsException("Format failed. " + error); + throw new Exception("Format failed. " + error); } this.process = Runtime.getRuntime() .exec(new String[] {exe, "start", "--addresses=" + TB_PORT, TB_FILE}); if (process.waitFor(100, TimeUnit.MILLISECONDS)) - throw new OperationsException("Start server failed"); + throw new Exception("Start server failed"); } @Override @@ -1172,7 +1171,7 @@ public void close() throws Exception { cleanUp(); } - private void cleanUp() throws OperationsException { + private void cleanUp() throws Exception { try { if (process != null && process.isAlive()) { @@ -1182,7 +1181,7 @@ private void cleanUp() throws OperationsException { var file = new File("./" + TB_FILE); file.delete(); } catch (Throwable any) { - throw new OperationsException("Cleanup has failed"); + throw new Exception("Cleanup has failed"); } } } diff --git a/src/tigerbeetle-java/src/test/java/module-info.test b/src/tigerbeetle-java/src/test/java/module-info.test new file mode 100644 index 0000000..7f21d2e --- /dev/null +++ b/src/tigerbeetle-java/src/test/java/module-info.test @@ -0,0 +1,3 @@ +open module com.tigerbeetle { + requires junit; +} \ No newline at end of file