docs: update queue-based load leveling

This commit is contained in:
Ilkka Seppälä
2024-05-18 08:54:56 +03:00
parent 551e3548d0
commit 1da0f41381
5 changed files with 133 additions and 226 deletions
@@ -90,7 +90,7 @@ public class App {
final var srvRunnable = new ServiceExecutor(msgQueue);
// Create a ThreadPool of 2 threads and
// submit all Runnable task for execution to executor..
// submit all Runnable task for execution to executor
executor = Executors.newFixedThreadPool(2);
executor.submit(taskRunnable1);
executor.submit(taskRunnable2);
@@ -48,7 +48,7 @@ public class ServiceExecutor implements Runnable {
var msg = msgQueue.retrieveMsg();
if (null != msg) {
LOGGER.info(msg.toString() + " is served.");
LOGGER.info(msg + " is served.");
} else {
LOGGER.info("Service Executor: Waiting for Messages to serve .. ");
}
@@ -59,4 +59,4 @@ public class ServiceExecutor implements Runnable {
LOGGER.error(e.getMessage());
}
}
}
}
@@ -27,7 +27,7 @@ package com.iluwatar.queue.load.leveling;
import lombok.extern.slf4j.Slf4j;
/**
* TaskGenerator class. Each TaskGenerator thread will be a Worker which submit's messages to the
* TaskGenerator class. Each TaskGenerator thread will be a Worker which submits messages to the
* queue. We need to mention the message count for each of the TaskGenerator threads.
*/
@Slf4j
@@ -24,10 +24,9 @@
*/
package com.iluwatar.queue.load.leveling;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
/**
* Test case for submitting Message to Blocking Queue by TaskGenerator and retrieve the message by