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ä
2025-03-29 19:34:27 +02:00
committed by GitHub
parent 371439aeaa
commit 0ca162a55c
1863 changed files with 14408 additions and 17637 deletions
@@ -31,11 +31,10 @@ import lombok.extern.slf4j.Slf4j;
/**
* Many solutions in the cloud involve running tasks that invoke services. In this environment, if a
* service is subjected to intermittent heavy loads, it can cause performance or reliability
* issues.
* service is subjected to intermittent heavy loads, it can cause performance or reliability issues.
*
* <p>A service could be a component that is part of the same solution as the tasks that utilize
* it, or it could be a third-party service providing access to frequently used resources such as a
* <p>A service could be a component that is part of the same solution as the tasks that utilize it,
* or it could be a third-party service providing access to frequently used resources such as a
* cache or a storage service. If the same service is utilized by a number of tasks running
* concurrently, it can be difficult to predict the volume of requests to which the service might be
* subjected at any given point in time.
@@ -45,8 +44,7 @@ import lombok.extern.slf4j.Slf4j;
* The task posts a message containing the data required by the service to a queue. The queue acts
* as a buffer, storing the message until it is retrieved by the service. The service retrieves the
* messages from the queue and processes them. Requests from a number of tasks, which can be
* generated at a highly variable rate, can be passed to the service through the same message
* queue.
* generated at a highly variable rate, can be passed to the service through the same message queue.
*
* <p>The queue effectively decouples the tasks from the service, and the service can handle the
* messages at its own pace irrespective of the volume of requests from concurrent tasks.
@@ -61,7 +59,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class App {
//Executor shut down time limit.
// Executor shut down time limit.
private static final int SHUTDOWN_TIME = 15;
/**
@@ -71,7 +69,7 @@ public class App {
*/
public static void main(String[] args) {
// An Executor that provides methods to manage termination and methods that can
// An Executor that provides methods to manage termination and methods that can
// produce a Future for tracking progress of one or more asynchronous tasks.
ExecutorService executor = null;
@@ -100,12 +98,13 @@ public class App {
executor.submit(srvRunnable);
// Initiates an orderly shutdown.
LOGGER.info("Initiating shutdown."
+ " Executor will shutdown only after all the Threads are completed.");
LOGGER.info(
"Initiating shutdown."
+ " Executor will shutdown only after all the Threads are completed.");
executor.shutdown();
// Wait for SHUTDOWN_TIME seconds for all the threads to complete
// their tasks and then shut down the executor and then exit.
// Wait for SHUTDOWN_TIME seconds for all the threads to complete
// their tasks and then shut down the executor and then exit.
if (!executor.awaitTermination(SHUTDOWN_TIME, TimeUnit.SECONDS)) {
LOGGER.info("Executor was shut down and Exiting.");
executor.shutdownNow();
@@ -114,4 +113,4 @@ public class App {
LOGGER.error(e.getMessage());
}
}
}
}
@@ -27,9 +27,7 @@ package com.iluwatar.queue.load.leveling;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* Message class with only one parameter.
*/
/** Message class with only one parameter. */
@Getter
@RequiredArgsConstructor
public class Message {
@@ -39,4 +37,4 @@ public class Message {
public String toString() {
return msg;
}
}
}
@@ -37,7 +37,7 @@ public class MessageQueue {
private final BlockingQueue<Message> blkQueue;
// Default constructor when called creates Blocking Queue object.
// Default constructor when called creates Blocking Queue object.
public MessageQueue() {
this.blkQueue = new ArrayBlockingQueue<>(1024);
}
@@ -39,9 +39,7 @@ public class ServiceExecutor implements Runnable {
this.msgQueue = msgQueue;
}
/**
* The ServiceExecutor thread will retrieve each message and process it.
*/
/** The ServiceExecutor thread will retrieve each message and process it. */
public void run() {
try {
while (!Thread.currentThread().isInterrupted()) {
@@ -24,9 +24,7 @@
*/
package com.iluwatar.queue.load.leveling;
/**
* Task Interface.
*/
/** Task Interface. */
public interface Task {
void submit(Message msg);
}
@@ -45,9 +45,7 @@ public class TaskGenerator implements Task, Runnable {
this.msgCount = msgCount;
}
/**
* Submit messages to the Blocking Queue.
*/
/** Submit messages to the Blocking Queue. */
public void submit(Message msg) {
try {
this.msgQueue.submitMsg(msg);
@@ -80,4 +78,4 @@ public class TaskGenerator implements Task, Runnable {
LOGGER.error(e.getMessage());
}
}
}
}