deps: Refactor dependencies (#3224)

* remove spring dep
move junit, logging, mockito under dep mgmt

* upgrade anti-corruption-layer deps

* async method invocation

* balking, bloc

* bridge to bytecode

* caching

* callback - cqrs

* component - health check

* hexagonal - metadata mapping

* rest of the patterns

* remove checkstyle, take spotless into use
This commit is contained in:
Ilkka Seppälä authored and GitHub committed 2025-03-29 19:34:27 +02:00
1 parent 371439aeaa
commit 0ca162a55c
1863 files changed
+14403 -17632

No files matched your search

+8
View File
@@ -35,6 +35,14 @@
<packaging>jar</packaging>
<artifactId>guarded-suspension</artifactId>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
@@ -30,14 +30,13 @@ import lombok.extern.slf4j.Slf4j;
/**
* Guarded-suspension is a concurrent design pattern for handling situation when to execute some
* action we need condition to be satisfied.
* The implementation utilizes a GuardedQueue, which features two primary methods: `get` and `put`.
* The key condition governing these operations is that elements cannot be retrieved (`get`) from
* an empty queue. When a thread attempts to retrieve an element under this condition, it triggers
* the invocation of the `wait` method from the Object class, causing the thread to pause.
* Conversely, when an element is added (`put`) to the queue by another thread, it invokes the
* `notify` method. This notifies the waiting thread that it can now successfully retrieve an
* element from the queue.
* action we need condition to be satisfied. The implementation utilizes a GuardedQueue, which
* features two primary methods: `get` and `put`. The key condition governing these operations is
* that elements cannot be retrieved (`get`) from an empty queue. When a thread attempts to retrieve
* an element under this condition, it triggers the invocation of the `wait` method from the Object
* class, causing the thread to pause. Conversely, when an element is added (`put`) to the queue by
* another thread, it invokes the `notify` method. This notifies the waiting thread that it can now
* successfully retrieve an element from the queue.
*/
@Slf4j
public class App {
@@ -50,7 +49,7 @@ public class App {
var guardedQueue = new GuardedQueue();
var executorService = Executors.newFixedThreadPool(3);
//here we create first thread which is supposed to get from guardedQueue
// here we create first thread which is supposed to get from guardedQueue
executorService.execute(guardedQueue::get);
// here we wait two seconds to show that the thread which is trying
@@ -33,7 +33,8 @@ import lombok.extern.slf4j.Slf4j;
* used to handle a situation when you want to execute a method on an object which is not in a
* proper state.
*
* @see <a href="http://java-design-patterns.com/patterns/guarded-suspension/">http://java-design-patterns.com/patterns/guarded-suspension/</a>
* @see <a
* href="http://java-design-patterns.com/patterns/guarded-suspension/">http://java-design-patterns.com/patterns/guarded-suspension/</a>
*/
@Slf4j
public class GuardedQueue {
@@ -31,9 +31,7 @@ import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
/**
* Test for Guarded Queue.
*/
/** Test for Guarded Queue. */
@Slf4j
class GuardedQueueTest {
private volatile Integer value;
@@ -59,5 +57,4 @@ class GuardedQueueTest {
g.put(12);
assertEquals(Integer.valueOf(12), g.get());
}
}