fix: #1297 Gateway pattern fixes (#2818)

* add to parent pom.xml

* update gateway readme
This commit is contained in:
Ilkka Seppälä
2024-03-10 11:25:37 +02:00
committed by GitHub
parent 961121c9b1
commit 98505c61dd
2 changed files with 5 additions and 5 deletions
+4 -5
View File
@@ -3,7 +3,6 @@ title: Gateway
category: Structural category: Structural
language: en language: en
tag: tag:
- Gang of Four
- Decoupling - Decoupling
--- ---
@@ -38,7 +37,7 @@ The main class in our example is the `ExternalService` that contains items.
class ExternalServiceA implements Gateway { class ExternalServiceA implements Gateway {
@Override @Override
public void execute() throws Exception { public void execute() throws Exception {
System.out.println("Executing Service A"); LOGGER.info("Executing Service A");
// Simulate a time-consuming task // Simulate a time-consuming task
Thread.sleep(1000); Thread.sleep(1000);
} }
@@ -50,7 +49,7 @@ class ExternalServiceA implements Gateway {
class ExternalServiceB implements Gateway { class ExternalServiceB implements Gateway {
@Override @Override
public void execute() throws Exception { public void execute() throws Exception {
System.out.println("Executing Service B"); LOGGER.info("Executing Service B");
// Simulate a time-consuming task // Simulate a time-consuming task
Thread.sleep(1000); Thread.sleep(1000);
} }
@@ -62,7 +61,7 @@ class ExternalServiceB implements Gateway {
class ExternalServiceC implements Gateway { class ExternalServiceC implements Gateway {
@Override @Override
public void execute() throws Exception { public void execute() throws Exception {
System.out.println("Executing Service C"); LOGGER.info("Executing Service C");
// Simulate a time-consuming task // Simulate a time-consuming task
Thread.sleep(1000); Thread.sleep(1000);
} }
@@ -100,7 +99,7 @@ public class App {
serviceB.execute(); serviceB.execute();
serviceC.execute(); serviceC.execute();
} catch (ThreadDeath e) { } catch (ThreadDeath e) {
System.out.println("Interrupted!" + e); LOGGER.info("Interrupted!" + e);
throw e; throw e;
} }
} }
+1
View File
@@ -212,6 +212,7 @@
<module>health-check</module> <module>health-check</module>
<module>notification</module> <module>notification</module>
<module>single-table-inheritance</module> <module>single-table-inheritance</module>
<module>gateway</module>
</modules> </modules>
<repositories> <repositories>
<repository> <repository>