docs: poison pill and private class data diagrams

This commit is contained in:
Ilkka Seppälä
2025-04-09 21:33:13 +03:00
parent fdd07c772c
commit 261da00a1b
6 changed files with 12 additions and 5 deletions
+4 -4
View File
@@ -29,6 +29,10 @@ In plain words
> Poison Pill is a known message structure that ends the message exchange.
Sequence diagram
![Poison Pill sequence diagram](./etc/poison-pill-sequence-diagram.png)
## Programmatic Example of Poison Pill Pattern in Java
In this Java example, the Poison Pill serves as a shutdown signal within message queues, demonstrating effective thread management and consumer communication.
@@ -210,10 +214,6 @@ Program output:
07:43:01.520 [Thread-0] INFO com.iluwatar.poison.pill.Consumer -- Consumer CONSUMER_1 receive request to terminate.
```
## Detailed Explanation of Poison Pill Pattern with Real-World Examples
![Poison Pill](./etc/poison-pill.png "Poison Pill")
## When to Use the Poison Pill Pattern in Java
Use the Poison Pill idiom when:
Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB