mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-17 00:25:54 +00:00
docs: Content SEO updates (#2990)
* update yaml frontmatter format * update abstract document * update abstract factory * use the new pattern template * acyclic visitor seo * adapter seo * ambassador seo * acl seo * aaa seo * async method invocation seo * balking seo * bridge seo * builder seo * business delegate and bytecode seo * caching seo * callback seo * chain seo * update headings * circuit breaker seo * client session + collecting parameter seo * collection pipeline seo * combinator SEO * command seo * cqrs seo * commander seo * component seo * composite seo * composite entity seo * composite view seo * context object seo * converter seo * crtp seo * currying seo * dao seo * data bus seo * data locality seo * data mapper seo * dto seo * decorator seo * delegation seo * di seo * dirty flag seo * domain model seo * double buffer seo * double checked locking seo * double dispatch seo * dynamic proxy seo * event aggregator seo * event-based asynchronous seo * eda seo * event queue seo * event sourcing seo * execute around seo * extension objects seo * facade seo * factory seo * factory kit seo * factory method seo * fanout/fanin seo * feature toggle seo * filterer seo * fluent interface seo * flux seo * flyweight seo * front controller seo * function composition seo * game loop seo * gateway seo * guarded suspension seo * half-sync/half-async seo * health check seo * hexagonal seo * identity map seo * intercepting filter seo * interpreter seo * iterator seo * layers seo * lazy loading seo * leader election seo * leader/followers seo * lockable object seo * rename and add seo for marker interface * master-worker seo * mediator seo * memento seo * metadata mapping seo * microservice aggregator seo * api gw seo * microservices log aggregration seo * mvc seo * mvi seo * mvp seo * mvvm seo * monad seo * monitor seo * monostate seo * multiton seo * mute idiom seo * naked objects & notification seo * null object seo * object mother seo * object pool seo * observer seo * optimistic locking seo * page controller seo * page object seo * parameter object seo * partial response seo * pipeline seo * poison pill seo * presentation model seo * private class data seo * producer-consumer seo * promise seo * property seo * prototype seo * proxy seo * queue-based load leveling seo * reactor seo * registry seo * repository seo * RAII seo * retry seo * role object seo * saga seo * separated interface seo * serialized entity seo * serialized lob seo * servant seo * server session seo * service layer seo * service locator seo * service to worker seo * sharding seo * single table inheritance seo * singleton seo * spatial partition seo * special case seo * specification seo * state seo * step builder seo * strangler seo * strategy seo * subclass sandbox seo * table module seo * template method seo * throttling seo * tolerant reader seo * trampoline seo * transaction script seo * twin seo * type object seo * unit of work seo * update method seo * value object seo * version number seo * virtual proxy seo * visitor seo * seo enhancements * seo improvements * SEO enhancements * SEO improvements * SEO additions * SEO improvements * more SEO improvements * rename hexagonal + SEO improvements * SEO improvements * more SEO stuff * SEO improvements * SEO optimizations * SEO enhancements * enchance SEO * improve SEO * SEO improvements * update headers
This commit is contained in:
+21
-17
@@ -1,12 +1,14 @@
|
||||
---
|
||||
title: Retry
|
||||
title: "Retry Pattern in Java: Building Fault-Tolerant Systems with Adaptive Retries"
|
||||
shortTitle: Retry
|
||||
description: "Explore the Retry pattern in Java for robust software design. Learn how to implement fault tolerance and improve application reliability through transparent retries of operations involving external communications like network requests."
|
||||
category: Resilience
|
||||
language: en
|
||||
tag:
|
||||
- Fault tolerance
|
||||
- Performance
|
||||
- Retry
|
||||
- Resilience
|
||||
- Fault tolerance
|
||||
- Performance
|
||||
- Retry
|
||||
- Resilience
|
||||
---
|
||||
|
||||
## Also known as
|
||||
@@ -14,11 +16,11 @@ tag:
|
||||
* Retry Logic
|
||||
* Retry Mechanism
|
||||
|
||||
## Intent
|
||||
## Intent of Retry Design Pattern
|
||||
|
||||
Transparently retry certain operations that involve communication with external resources, particularly over the network, isolating calling code from the retry implementation details.
|
||||
The Retry pattern in Java transparently retries certain operations that involve communication with external resources, particularly over the network, isolating calling code from the retry implementation details. It is crucial for developing resilient software systems that handle transient failures gracefully.
|
||||
|
||||
## Explanation
|
||||
## Detailed Explanation of Retry Pattern with Real-World Examples
|
||||
|
||||
Real-world example
|
||||
|
||||
@@ -32,9 +34,9 @@ In plain words
|
||||
|
||||
> Enable an application to handle transient failures when it tries to connect to a service or network resource, by transparently retrying a failed operation. This can improve the stability of the application.
|
||||
|
||||
**Programmatic Example**
|
||||
## Programmatic Example of Retry Pattern in Java
|
||||
|
||||
The Retry design pattern is a resilience pattern that allows an application to retry an operation in the expectation that it'll succeed. This pattern is particularly useful when the application is connecting to a network service or a remote resource, where temporary failures are common.
|
||||
The Retry design pattern is a resilience pattern that allows an application to transparently attempt to execute operations multiple times in the expectation that it'll succeed. This pattern is particularly useful when the application is connecting to a network service or a remote resource, where temporary failures are common.
|
||||
|
||||
First, we have a `BusinessOperation` interface that represents an operation that can be performed and might throw a `BusinessException`.
|
||||
|
||||
@@ -189,18 +191,20 @@ Running the code produces the following console output.
|
||||
|
||||
This way, the Retry pattern allows the application to handle temporary failures gracefully, improving its resilience and reliability.
|
||||
|
||||
## Applicability
|
||||
## When to Use the Retry Pattern in Java
|
||||
|
||||
* Use when operations can fail transiently, such as network calls, database connections, or external service integrations.
|
||||
* Ideal for scenarios where the likelihood of transient failure is high but the cost of retries is low.
|
||||
Applying the Retry pattern is particularly effective
|
||||
|
||||
## Known Uses
|
||||
* When operations can fail transiently, such as network calls, database connections, or external service integrations.
|
||||
* In scenarios where the likelihood of transient failure is high but the cost of retries is low.
|
||||
|
||||
## Real-World Applications of Retry Pattern in Java
|
||||
|
||||
* In network communication libraries to handle transient failures.
|
||||
* Database connection libraries to manage temporary outages or timeouts.
|
||||
* APIs interacting with third-party services that may be temporarily unavailable.
|
||||
|
||||
## Consequences
|
||||
## Benefits and Trade-offs of Retry Pattern
|
||||
|
||||
Benefits:
|
||||
|
||||
@@ -213,11 +217,11 @@ Trade-offs:
|
||||
* Can lead to resource exhaustion if not managed properly.
|
||||
* Requires careful configuration of retry parameters to avoid exacerbating the problem.
|
||||
|
||||
## Related Patterns
|
||||
## Related Java Design Patterns
|
||||
|
||||
* [Circuit Breaker](https://java-design-patterns.com/patterns/circuit-breaker/): Used to stop the flow of requests to an external service after a failure threshold is reached, preventing system overload.
|
||||
|
||||
## Credits
|
||||
## References and Credits
|
||||
|
||||
* [Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications](https://amzn.to/4dLvowg)
|
||||
* [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3w0pvKI)
|
||||
|
||||
Reference in New Issue
Block a user