docs: add diagrams for lazy loading, leader election, leader followers, lockable object

This commit is contained in:
Ilkka Seppälä committed 2025-04-06 21:22:32 +03:00
1 parent d8b07ac484
commit 72eeb167c5
8 files changed
+16 -8

No files matched your search

+4 -4
View File
@@ -35,6 +35,10 @@ Wikipedia says
> In distributed computing, leader election is the process of designating a single process as the organizer of some task distributed among several computers (nodes). Before the task has begun, all network nodes are either unaware which node will serve as the "leader" (or coordinator) of the task, or unable to communicate with the current coordinator. After a leader election algorithm has been run, however, each node throughout the network recognizes a particular, unique node as the task leader.
Sequence diagram
![Leader Election Sequence Diagram](./etc/leader-election-sequence-diagram.png)
## Programmatic Example of Leader Election Pattern in Java
The Leader Election pattern is a design approach that enables a distributed system to select one node as the coordinator or leader to manage tasks and maintain order, while other nodes operate as followers. This pattern is particularly useful in distributed systems where one node needs to act as a central coordinator for a specific function or decision-making process.
@@ -137,10 +141,6 @@ The `RingApp` class implements the Ring algorithm for leader election. In this a
These examples demonstrate how the Leader Election pattern can be implemented in different ways to suit the specific requirements of a distributed system.
## Detailed Explanation of Leader Election Pattern with Real-World Examples
![Leader Election](./etc/leader-election.urm.png "Leader Election pattern class diagram")
## When to Use the Leader Election Pattern in Java
Use the Leader Election pattern in Java applications where:
Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB