This project serves as a demo for BlockHound, which detects execution of blocking code (eg. Thread#sleep
) inside non-blocking threads.
It is particularly useful when enabled during tests execution to discover these issues before bringing them in production.
The AllowLoggingIntegration.java
shows a way to change BlockHound settings during tests execution by using custom integrations.
The BlockHoundDemoApplicationTests.java
class shows a very straightforward example of wrongly/correctly invoking blocking operations relying on different Reactor schedulers (parallel vs elastic).
The StateMachineTransitionServiceTests.java
is just a way more realistic and probable example of the same.
Just run mvn clean test
, sit back and relax.
For further reference, please consider the following resources: