Skip to content

Commit 4e0c2c2

Browse files
authored
Merge branch 'master' into master
2 parents 24d5063 + 61c12b5 commit 4e0c2c2

File tree

51 files changed

+1376
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1376
-67
lines changed

.all-contributorsrc

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2641,7 +2641,107 @@
26412641
"contributions": [
26422642
"doc",
26432643
"code"
2644-
]
2644+
]
2645+
},
2646+
{
2647+
"login": "Upendra-Allagadda",
2648+
"name": "Allagadda Sai Upendranath",
2649+
"avatar_url": "https://avatars.githubusercontent.com/u/25962010?v=4",
2650+
"profile": "https://github.com/Upendra-Allagadda",
2651+
"contributions": [
2652+
"doc"
2653+
]
2654+
},
2655+
{
2656+
"login": "mathbraga",
2657+
"name": "Matheus Braga",
2658+
"avatar_url": "https://avatars.githubusercontent.com/u/31048764?v=4",
2659+
"profile": "https://www.linkedin.com/in/mobraga/",
2660+
"contributions": [
2661+
"translation",
2662+
"doc"
2663+
]
2664+
},
2665+
{
2666+
"login": "satyabarghav",
2667+
"name": "Appari Satya Barghav",
2668+
"avatar_url": "https://avatars.githubusercontent.com/u/36763910?v=4",
2669+
"profile": "https://github.com/satyabarghav",
2670+
"contributions": [
2671+
"doc"
2672+
]
2673+
},
2674+
{
2675+
"login": "mribeirodantas",
2676+
"name": "Marcel Ribeiro-Dantas",
2677+
"avatar_url": "https://avatars.githubusercontent.com/u/1023197?v=4",
2678+
"profile": "http://mribeirodantas.me",
2679+
"contributions": [
2680+
"doc"
2681+
]
2682+
},
2683+
{
2684+
"login": "hamexhanif",
2685+
"name": "Muhammad Hanif Amrullah",
2686+
"avatar_url": "https://avatars.githubusercontent.com/u/74542852?v=4",
2687+
"profile": "https://github.com/hamexhanif",
2688+
"contributions": [
2689+
"translation"
2690+
]
2691+
},
2692+
{
2693+
"login": "JackH408",
2694+
"name": "JackH408",
2695+
"avatar_url": "https://avatars.githubusercontent.com/u/141727294?v=4",
2696+
"profile": "https://github.com/JackH408",
2697+
"contributions": [
2698+
"doc"
2699+
]
2700+
},
2701+
{
2702+
"login": "versus2004",
2703+
"name": "Shubham",
2704+
"avatar_url": "https://avatars.githubusercontent.com/u/132815243?v=4",
2705+
"profile": "https://github.com/versus2004",
2706+
"contributions": [
2707+
"translation"
2708+
]
2709+
},
2710+
{
2711+
"login": "inishantjain",
2712+
"name": "Nishant Jain",
2713+
"avatar_url": "https://avatars.githubusercontent.com/u/121454072?v=4",
2714+
"profile": "https://github.com/inishantjain",
2715+
"contributions": [
2716+
"doc"
2717+
]
2718+
},
2719+
{
2720+
"login": "hallowshaw",
2721+
"name": "Rhitam Chaudhury",
2722+
"avatar_url": "https://avatars.githubusercontent.com/u/90751158?v=4",
2723+
"profile": "https://github.com/hallowshaw",
2724+
"contributions": [
2725+
"doc"
2726+
]
2727+
},
2728+
{
2729+
"login": "JerryZhao275",
2730+
"name": "JerryZhao275",
2731+
"avatar_url": "https://avatars.githubusercontent.com/u/132061401?v=4",
2732+
"profile": "https://github.com/JerryZhao275",
2733+
"contributions": [
2734+
"doc"
2735+
]
2736+
},
2737+
{
2738+
"login": "leonardol",
2739+
"name": "Leonardo Lisanti",
2740+
"avatar_url": "https://avatars.githubusercontent.com/u/1445890?v=4",
2741+
"profile": "https://twitter.com/llisant",
2742+
"contributions": [
2743+
"translation"
2744+
]
26452745
}
26462746
],
26472747
"contributorsPerLine": 7,

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- the line below needs to be an empty line C: (its because kramdown isnt
1+
<!-- the line below needs to be an empty line C: (its because kramdown isn't
22
that smart and dearly wants an empty line before a heading to be able to
33
display it as such, e.g. website) -->
44

@@ -10,7 +10,7 @@
1010
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
1111
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1212
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
13-
[![All Contributors](https://img.shields.io/badge/all_contributors-289-orange.svg?style=flat-square)](#contributors-)
13+
[![All Contributors](https://img.shields.io/badge/all_contributors-301-orange.svg?style=flat-square)](#contributors-)
1414
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1515

1616
<br/>
@@ -448,6 +448,19 @@ This project is licensed under the terms of the MIT license.
448448
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sanchitbansal10"><img src="https://avatars.githubusercontent.com/u/16536741?v=4?s=100" width="100px;" alt="Sanchit Bansal"/><br /><sub><b>Sanchit Bansal</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=sanchitbansal10" title="Documentation">📖</a></td>
449449
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mm-saiful6854"><img src="https://avatars.githubusercontent.com/u/48361160?v=4?s=100" width="100px;" alt="Md Saiful Islam"/><br /><sub><b>Md Saiful Islam</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=mm-saiful6854" title="Documentation">📖</a></td>
450450
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AddeusExMachina"><img src="https://avatars.githubusercontent.com/u/39912670?v=4?s=100" width="100px;" alt="Antonio Addeo"/><br /><sub><b>Antonio Addeo</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=AddeusExMachina" title="Documentation">📖</a> <a href="https://github.com/iluwatar/java-design-patterns/commits?author=AddeusExMachina" title="Code">💻</a></td>
451+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Upendra-Allagadda"><img src="https://avatars.githubusercontent.com/u/25962010?v=4?s=100" width="100px;" alt="Allagadda Sai Upendranath"/><br /><sub><b>Allagadda Sai Upendranath</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Upendra-Allagadda" title="Documentation">📖</a></td>
452+
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/mobraga/"><img src="https://avatars.githubusercontent.com/u/31048764?v=4?s=100" width="100px;" alt="Matheus Braga"/><br /><sub><b>Matheus Braga</b></sub></a><br /><a href="#translation-mathbraga" title="Translation">🌍</a> <a href="https://github.com/iluwatar/java-design-patterns/commits?author=mathbraga" title="Documentation">📖</a></td>
453+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/satyabarghav"><img src="https://avatars.githubusercontent.com/u/36763910?v=4?s=100" width="100px;" alt="Appari Satya Barghav"/><br /><sub><b>Appari Satya Barghav</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=satyabarghav" title="Documentation">📖</a></td>
454+
<td align="center" valign="top" width="14.28%"><a href="http://mribeirodantas.me"><img src="https://avatars.githubusercontent.com/u/1023197?v=4?s=100" width="100px;" alt="Marcel Ribeiro-Dantas"/><br /><sub><b>Marcel Ribeiro-Dantas</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=mribeirodantas" title="Documentation">📖</a></td>
455+
</tr>
456+
<tr>
457+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hamexhanif"><img src="https://avatars.githubusercontent.com/u/74542852?v=4?s=100" width="100px;" alt="Muhammad Hanif Amrullah"/><br /><sub><b>Muhammad Hanif Amrullah</b></sub></a><br /><a href="#translation-hamexhanif" title="Translation">🌍</a></td>
458+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JackH408"><img src="https://avatars.githubusercontent.com/u/141727294?v=4?s=100" width="100px;" alt="JackH408"/><br /><sub><b>JackH408</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=JackH408" title="Documentation">📖</a></td>
459+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/versus2004"><img src="https://avatars.githubusercontent.com/u/132815243?v=4?s=100" width="100px;" alt="Shubham"/><br /><sub><b>Shubham</b></sub></a><br /><a href="#translation-versus2004" title="Translation">🌍</a></td>
460+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/inishantjain"><img src="https://avatars.githubusercontent.com/u/121454072?v=4?s=100" width="100px;" alt="Nishant Jain"/><br /><sub><b>Nishant Jain</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=inishantjain" title="Documentation">📖</a></td>
461+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hallowshaw"><img src="https://avatars.githubusercontent.com/u/90751158?v=4?s=100" width="100px;" alt="Rhitam Chaudhury"/><br /><sub><b>Rhitam Chaudhury</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=hallowshaw" title="Documentation">📖</a></td>
462+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/JerryZhao275"><img src="https://avatars.githubusercontent.com/u/132061401?v=4?s=100" width="100px;" alt="JerryZhao275"/><br /><sub><b>JerryZhao275</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=JerryZhao275" title="Documentation">📖</a></td>
463+
<td align="center" valign="top" width="14.28%"><a href="https://twitter.com/llisant"><img src="https://avatars.githubusercontent.com/u/1445890?v=4?s=100" width="100px;" alt="Leonardo Lisanti"/><br /><sub><b>Leonardo Lisanti</b></sub></a><br /><a href="#translation-leonardol" title="Translation">🌍</a></td>
451464
</tr>
452465
</tbody>
453466
</table>

adapter/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ Use the Adapter pattern when
107107
* [Dzone](https://dzone.com/articles/adapter-design-pattern-in-java)
108108
* [Refactoring Guru](https://refactoring.guru/design-patterns/adapter/java/example)
109109
* [Baeldung](https://www.baeldung.com/java-adapter-pattern)
110+
* [GeeksforGeeks](https://www.geeksforgeeks.org/adapter-pattern/)
111+
110112

111113
## Consequences
112114
Class and object adapters have different trade-offs. A class adapter

adapter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
55
66
The MIT License
7-
Copyright © 2014-2022 Ilkka Seppälä
7+
Copyright © 2014-2023 Ilkka Seppälä
88
99
Permission is hereby granted, free of charge, to any person obtaining a copy
1010
of this software and associated documentation files (the "Software"), to deal

aggregator-microservices/information-microservice/src/main/java/com/iluwatar/information/microservice/InformationController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class InformationController {
3535

3636
/**
37-
* Endpoint to retrieve a product's informations.
37+
* Endpoint to retrieve a product's information.
3838
*
3939
* @return product inventory.
4040
*/

caching/src/main/java/com/iluwatar/caching/database/DbManagerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
package com.iluwatar.caching.database;
2626

2727
/**
28-
* Creates the database connection accroding the input parameter.
28+
* Creates the database connection according the input parameter.
2929
*/
3030
public final class DbManagerFactory {
3131
/**

circuit-breaker/src/main/java/com/iluwatar/circuitbreaker/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/**
3030
* <p>
3131
* The intention of the Circuit Builder pattern is to handle remote failures robustly, which is to
32-
* mean that if a service is dependant on n number of other services, and m of them fail, we should
32+
* mean that if a service is dependent on n number of other services, and m of them fail, we should
3333
* be able to recover from that failure by ensuring that the user can still use the services that
3434
* are actually functional, and resources are not tied up by uselessly by the services which are not
3535
* working. However, we should also be able to detect when any of the m failing services become

circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public String call() throws RemoteServiceException {
7474
}
7575
};
7676
var circuitBreaker = new DefaultCircuitBreaker(mockService, 1, 1, 100);
77-
//Call with the paramater start_time set to huge amount of time in past so that service
77+
//Call with the parameter start_time set to huge amount of time in past so that service
7878
//replies with "Ok". Also, state is CLOSED in start
7979
var serviceStartTime = System.nanoTime() - 60 * 1000 * 1000 * 1000;
8080
var response = circuitBreaker.attemptRequest();

commander/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This pattern can be used when we need to make commits into 2 (or more) databases
1818

1919
## Explanation
2020
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?
21-
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.
21+
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.
2222

2323
## Credits
2424

crtp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,5 @@ Use the Curiously Recurring Template Pattern when
134134

135135
## Credits
136136

137-
* [How do I decrypt "Enum<E extends Enum<E>>"?](http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#FAQ106)
137+
* [How do I decrypt "Enum<E extends Enum\<E>>"?](http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#FAQ106)
138138
* Chapter 5 Generics, Item 30 in [Effective Java](https://www.amazon.com/gp/product/0134685997/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0134685997&linkCode=as2&tag=javadesignpat-20&linkId=4e349f4b3ff8c50123f8147c828e53eb)

0 commit comments

Comments
 (0)