mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 00:59:37 +00:00
refactor: rename queue based load leveling
This commit is contained in:
@@ -139,7 +139,7 @@
|
||||
<module>page-object</module>
|
||||
<module>event-based-asynchronous</module>
|
||||
<module>event-queue</module>
|
||||
<module>queue-load-leveling</module>
|
||||
<module>queue-based-load-leveling</module>
|
||||
<module>object-mother</module>
|
||||
<module>data-bus</module>
|
||||
<module>converter</module>
|
||||
|
||||
@@ -48,7 +48,9 @@ First, let's look at the `MessageQueue` and `Message` classes. The `MessageQueue
|
||||
public class Message {
|
||||
// Message details
|
||||
}
|
||||
```
|
||||
|
||||
```java
|
||||
public class MessageQueue {
|
||||
private Queue<Message> queue;
|
||||
|
||||
@@ -72,6 +74,7 @@ Next, we have the `TaskGenerator` class. This class represents the task producer
|
||||
|
||||
```java
|
||||
public class TaskGenerator implements Runnable {
|
||||
|
||||
private MessageQueue msgQueue;
|
||||
private int taskCount;
|
||||
|
||||
@@ -94,6 +97,7 @@ The `ServiceExecutor` class represents the task consumer. It retrieves tasks fro
|
||||
|
||||
```java
|
||||
public class ServiceExecutor implements Runnable {
|
||||
|
||||
private MessageQueue msgQueue;
|
||||
|
||||
public ServiceExecutor(MessageQueue msgQueue) {
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -32,7 +32,7 @@
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.26.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>queue-load-leveling</artifactId>
|
||||
<artifactId>queue-based-load-leveling</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
Reference in New Issue
Block a user