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:
Ilkka Seppälä
2024-06-08 19:54:44 +03:00
committed by GitHub
parent cb946c0cdc
commit 6cd2d0353a
219 changed files with 3308 additions and 2819 deletions
+19 -15
View File
@@ -1,22 +1,24 @@
---
title: Multiton
title: "Multiton Pattern in Java: Mastering Advanced Singleton Variants"
shortTitle: Multiton
description: "Learn how the Multiton pattern in Java ensures unique named instances and provides a global access point. Discover implementation tips and code examples."
category: Creational
language: en
tag:
- Decoupling
- Instantiation
- Object composition
- Decoupling
- Instantiation
- Object composition
---
## Also known as
* Registry of Singletons
## Intent
## Intent of Multiton Design Pattern
The Multiton pattern is a variation of the Singleton design pattern that manages a map of named instances as key-value pairs.
The Multiton pattern in Java ensures a class has only unique named instances, providing a global point of access to them. Each named instance is accessed through a unique key, making it an essential part of Java design patterns.
## Explanation
## Detailed Explanation of Multiton Pattern with Real-World Examples
Real-world example
@@ -24,13 +26,15 @@ Real-world example
In plain words
> Multiton pattern ensures there are a predefined amount of instances available globally.
> The Multiton pattern is an extension of the Singleton pattern, offering a way to have a map of unique named instances instead of a single instance. This makes it a valuable Java design pattern for managing named instances efficiently.
Wikipedia says
> In software engineering, the multiton pattern is a design pattern which generalizes the singleton pattern. Whereas the singleton allows only one instance of a class to be created, the multiton pattern allows for the controlled creation of multiple instances, which it manages through the use of a map.
**Programmatic Example**
## Programmatic Example of Multiton Pattern in Java
In this tutorial, well explore how to implement the Multiton pattern in Java, covering its structure, benefits, and providing code examples. By following these implementation tips, youll be able to effectively utilize this Java design pattern.
The Nazgûl, also called ringwraiths or the Nine Riders, are Sauron's most terrible servants. By definition, there's always nine of them.
@@ -127,20 +131,20 @@ Program output:
15:16:10.601 [main] INFO com.iluwatar.multiton.App -- UVATHA=UVATHA
```
## Applicability
## When to Use the Multiton Pattern in Java
Use the Multiton pattern when
Use cases for the Multiton pattern in Java
* A class must have named instances, but only one instance for each unique key.
* Global access to these instances is necessary without requiring global variables.
* You want to manage shared resources categorized by key.
## Known Uses
## Real-World Applications of Multiton Pattern in Java
* Managing database connections in different contexts.
* Configuration settings for different environments in an application.
## Consequences
## Benefits and Trade-offs of Multiton Pattern
Benefits:
@@ -152,11 +156,11 @@ Trade-offs:
* Increased memory usage if not managed properly due to multiple instances.
* Potential issues with concurrency if not implemented with thread safety in mind.
## Related Patterns
## Related Java Design Patterns
* [Singleton](https://java-design-patterns.com/patterns/singleton/): Multiton can be seen as an extension of the Singleton pattern where Singleton allows only one instance of a class, Multiton allows one instance per key.
* [Factory Method](https://java-design-patterns.com/patterns/factory-method/): Multiton uses a method to create or retrieve instances, similar to how a Factory Method controls object creation.
## Credits
## References and Credits
* [Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3w0pvKI)