Skip to content

Commit

Permalink
Downgrade to Java 21 due to raphw/byte-buddy#1609 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
EdAddario committed Apr 14, 2024
1 parent 92df290 commit 21747c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<description>Comparing Project Reactor vs Loom and getting them to work together</description>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<blockhound.version>1.0.8.RELEASE</blockhound.version>
<exec.mainClass>org.addario.ReactiveLoom</exec.mainClass>
Expand Down Expand Up @@ -73,6 +73,7 @@
<compilerArgs>
<arg>--enable-preview</arg>
<arg>-XX:+EnableDynamicAgentLoading</arg>
<arg>-XX:+AllowRedefinitionToAddDeleteMethods</arg>
</compilerArgs>
</configuration>
</plugin>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/addario/ReactiveLoom.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.addario;

import reactor.tools.agent.ReactorDebugAgent;
import reactor.blockhound.BlockHound;
import reactor.tools.agent.ReactorDebugAgent;

import java.io.File;
import java.util.UUID;
Expand All @@ -10,11 +10,11 @@ public class ReactiveLoom {
public static void main(String[] args) throws InterruptedException {
var quantity = 2_000_000; // Generating 2 million payment records should take around 10 seconds and will use about 3.9 GB of memory
var batchSize = 100_000; // quantity / batchSize = how many groups of payments to process in parallel
var fileName = STR."\{UUID.randomUUID().toString()}.txt"; // Using Java 22 preview features so must be compiled/run with --enable-preview
var fileName = STR."\{UUID.randomUUID().toString()}.txt"; // Using Java 21 preview features so must be compiled/run with --enable-preview
var file = new File(fileName); // A file with 2 million records will take around 3.3 GB
System.setProperty("reactor.schedulers.defaultBoundedElasticOnVirtualThreads", "true");
System.setProperty("reactor.schedulers.defaultBoundedElasticOnVirtualThreads", "true"); // Use virtual threads (projet Loom) in bounded elastic scheduler

ReactorDebugAgent.init(); // Dev friendly reactor stack traces
ReactorDebugAgent.init(); // Dev friendly reactive stack traces
BlockHound.install(); // Detect and throw on blocking calls from non-blocking threads

var paymentsList = TimedExecution.createPaymentsList(quantity);
Expand Down

0 comments on commit 21747c6

Please sign in to comment.