diff --git a/README.md b/README.md index 377729b96..181a983c7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - diff --git a/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java b/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java index 7a1706cac..88d11e5f4 100644 --- a/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java +++ b/aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java @@ -34,7 +34,7 @@ import org.springframework.web.bind.annotation.RestController; public class InformationController { /** - * Endpoint to retrieve a product's informations. + * Endpoint to retrieve a product's information. * * @return product inventory. */ diff --git a/caching/src/main/java/com/iluwatar/caching/database/DbManagerFactory.java b/caching/src/main/java/com/iluwatar/caching/database/DbManagerFactory.java index 85c2baead..ee7a4a04b 100644 --- a/caching/src/main/java/com/iluwatar/caching/database/DbManagerFactory.java +++ b/caching/src/main/java/com/iluwatar/caching/database/DbManagerFactory.java @@ -25,7 +25,7 @@ package com.iluwatar.caching.database; /** - * Creates the database connection accroding the input parameter. + * Creates the database connection according the input parameter. */ public final class DbManagerFactory { /** diff --git a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java index dca327406..6db5ad936 100644 --- a/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java +++ b/circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java @@ -29,7 +29,7 @@ import lombok.extern.slf4j.Slf4j; /** *
* The intention of the Circuit Builder pattern is to handle remote failures robustly, which is to - * mean that if a service is dependant on n number of other services, and m of them fail, we should + * mean that if a service is dependent on n number of other services, and m of them fail, we should * be able to recover from that failure by ensuring that the user can still use the services that * are actually functional, and resources are not tied up by uselessly by the services which are not * working. However, we should also be able to detect when any of the m failing services become diff --git a/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java b/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java index 817a1e7d0..465371a3a 100644 --- a/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java +++ b/circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java @@ -74,7 +74,7 @@ class DefaultCircuitBreakerTest { } }; var circuitBreaker = new DefaultCircuitBreaker(mockService, 1, 1, 100); - //Call with the paramater start_time set to huge amount of time in past so that service + //Call with the parameter start_time set to huge amount of time in past so that service //replies with "Ok". Also, state is CLOSED in start var serviceStartTime = System.nanoTime() - 60 * 1000 * 1000 * 1000; var response = circuitBreaker.attemptRequest(); diff --git a/commander/README.md b/commander/README.md index 334bc4463..472370f4b 100644 --- a/commander/README.md +++ b/commander/README.md @@ -18,7 +18,7 @@ This pattern can be used when we need to make commits into 2 (or more) databases ## Explanation Handling distributed transactions can be tricky, but if we choose to not handle it carefully, there could be unwanted consequences. Say, we have an e-commerce website which has a Payment microservice and a Shipping microservice. If the shipping is available currently but payment service is not up, or vice versa, how would we deal with it after having already received the order from the user? -We need a mechanism in place which can handle these kinds of situations. We have to direct the order to either one of the services (in this example, shipping) and then add the order into the database of the other service (in this example, payment), since two databses cannot be updated atomically. If currently unable to do it, there should be a queue where this request can be queued, and there has to be a mechanism which allows for a failure in the queueing as well. All this needs to be done by constant retries while ensuring idempotence (even if the request is made several times, the change should only be applied once) by a commander class, to reach a state of eventual consistency. +We need a mechanism in place which can handle these kinds of situations. We have to direct the order to either one of the services (in this example, shipping) and then add the order into the database of the other service (in this example, payment), since two databases cannot be updated atomically. If currently unable to do it, there should be a queue where this request can be queued, and there has to be a mechanism which allows for a failure in the queueing as well. All this needs to be done by constant retries while ensuring idempotence (even if the request is made several times, the change should only be applied once) by a commander class, to reach a state of eventual consistency. ## Credits diff --git a/currying/README.md b/currying/README.md index 044c5df03..9f32c9066 100644 --- a/currying/README.md +++ b/currying/README.md @@ -183,7 +183,7 @@ Cons * As shown in the programmatic example above, curried functions with several parameters have a cumbersome type signature (in Java). ## Related patterns -* [Builder patter](https://java-design-patterns.com/patterns/builder/) +* [Builder pattern](https://java-design-patterns.com/patterns/builder/) ## Credits * [Currying in Java](https://www.baeldung.com/java-currying) diff --git a/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java b/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java index 0d96a9b3c..3e5419286 100644 --- a/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java +++ b/data-mapper/src/main/java/com/iluwatar/datamapper/DataMapperException.java @@ -25,7 +25,7 @@ package com.iluwatar.datamapper; /** - * Using Runtime Exception for avoiding dependancy on implementation exceptions. This helps in + * Using Runtime Exception for avoiding dependency on implementation exceptions. This helps in * decoupling. * * @author amit.dixit diff --git a/embedded-value/src/main/java/com/iluwatar/embedded/value/App.java b/embedded-value/src/main/java/com/iluwatar/embedded/value/App.java index 3a5162960..37ec26179 100644 --- a/embedded-value/src/main/java/com/iluwatar/embedded/value/App.java +++ b/embedded-value/src/main/java/com/iluwatar/embedded/value/App.java @@ -62,7 +62,7 @@ public class App { // Create table for orders - Orders(id, name, orderedBy, city, state, pincode). // We can see that table is different from the Order object we have. - // We're mapping ShippingAddress into city, state, pincode colummns of the database and not creating a separate table. + // We're mapping ShippingAddress into city, state, pincode columns of the database and not creating a separate table. if (dataSource.createSchema()) { LOGGER.info("TABLE CREATED"); LOGGER.info("Table \"Orders\" schema:\n" + dataSource.getSchema()); @@ -95,7 +95,7 @@ public class App { dataSource.removeOrder(1); LOGGER.info("\nOrders Query: {}", dataSource.queryOrders().collect(Collectors.toList()) + "\n"); - //After successfull demonstration of the pattern, drop the table + //After successful demonstration of the pattern, drop the table if (dataSource.deleteSchema()) { LOGGER.info("TABLE DROPPED"); } else { diff --git a/event-queue/src/main/java/com/iluwatar/event/queue/Audio.java b/event-queue/src/main/java/com/iluwatar/event/queue/Audio.java index f668b61c7..242e6fbdd 100644 --- a/event-queue/src/main/java/com/iluwatar/event/queue/Audio.java +++ b/event-queue/src/main/java/com/iluwatar/event/queue/Audio.java @@ -144,7 +144,7 @@ public class Audio { clip.open(audioStream); clip.start(); } catch (LineUnavailableException e) { - LOGGER.trace("Error occoured while loading the audio: The line is unavailable", e); + LOGGER.trace("Error occurred while loading the audio: The line is unavailable", e); } catch (IOException e) { LOGGER.trace("Input/Output error while loading the audio", e); } catch (IllegalArgumentException e) { diff --git a/fanout-fanin/README.md b/fanout-fanin/README.md index 9f48160f9..5d519528c 100644 --- a/fanout-fanin/README.md +++ b/fanout-fanin/README.md @@ -18,7 +18,7 @@ service has received the requests. Now the caller will not wait or expect the re Meanwhile, the pattern service will invoke the requests that have come. The requests might complete at different time. These requests will be processed in different instances of the same function in different machines or services. As the -requests get completed, a callback service everytime is called that transforms the result into a common single object format +requests get completed, a callback service every time is called that transforms the result into a common single object format that gets pushed to a consumer. The caller will be at the other end of the consumer receiving the result. **Programmatic Example** diff --git a/fanout-fanin/src/main/java/com/iluwatar/fanout/fanin/Consumer.java b/fanout-fanin/src/main/java/com/iluwatar/fanout/fanin/Consumer.java index acb1f2a05..90b7c6385 100644 --- a/fanout-fanin/src/main/java/com/iluwatar/fanout/fanin/Consumer.java +++ b/fanout-fanin/src/main/java/com/iluwatar/fanout/fanin/Consumer.java @@ -30,7 +30,7 @@ import lombok.Getter; /** - * Consumer or callback class that will be called everytime a request is complete This will + * Consumer or callback class that will be called every time a request is complete This will * aggregate individual result to form a final result. */ @Getter diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java index 1f5359e19..421f86e4c 100644 --- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java +++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/App.java @@ -39,8 +39,8 @@ import lombok.extern.slf4j.Slf4j; * version of the feature toggle, where the enhanced version of the welcome message which is * personalised is turned either on or off at instance creation. This method is not as dynamic as * the {@link User} driven version where the feature of the personalised welcome message is - * dependant on the {@link UserGroup} the {@link User} is in. So if the user is a memeber of the - * {@link UserGroup#isPaid(User)} then they get an ehanced version of the welcome message. + * dependent on the {@link UserGroup} the {@link User} is in. So if the user is a member of the + * {@link UserGroup#isPaid(User)} then they get an enhanced version of the welcome message. * *
Note that this pattern can easily introduce code complexity, and if not kept in check can
* result in redundant unmaintained code within the codebase.
diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java
index e70a581a6..ce7886a10 100644
--- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java
+++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/propertiesversion/PropertiesFeatureToggleVersion.java
@@ -30,7 +30,7 @@ import java.util.Properties;
import lombok.Getter;
/**
- * This example of the Feature Toogle pattern is less dynamic version than {@link
+ * This example of the Feature Toggle pattern is less dynamic version than {@link
* com.iluwatar.featuretoggle.pattern.tieredversion.TieredFeatureToggleVersion} where the feature is
* turned on or off at the time of creation of the service. This example uses simple Java {@link
* Properties} however it could as easily be done with an external configuration file loaded by
diff --git a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java
index f846f990c..74eb44340 100644
--- a/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java
+++ b/feature-toggle/src/main/java/com/iluwatar/featuretoggle/pattern/tieredversion/TieredFeatureToggleVersion.java
@@ -29,7 +29,7 @@ import com.iluwatar.featuretoggle.user.User;
import com.iluwatar.featuretoggle.user.UserGroup;
/**
- * This example of the Feature Toogle pattern shows how it could be implemented based on a {@link
+ * This example of the Feature Toggle pattern shows how it could be implemented based on a {@link
* User}. Therefore showing its use within a tiered application where the paying users get access to
* different content or better versions of features. So in this instance a {@link User} is passed in
* and if they are found to be on the {@link UserGroup#isPaid(User)} they are welcomed with a
diff --git a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java
index eab9787d8..82f89f89c 100644
--- a/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java
+++ b/leader-election/src/main/java/com/iluwatar/leaderelection/AbstractMessageManager.java
@@ -37,7 +37,7 @@ public abstract class AbstractMessageManager implements MessageManager {
protected Map