File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ layout : pattern
3+ title : Mute Idiom
4+ folder : mute-idiom
5+ permalink : /patterns/mute-idiom/
6+ categories : Other
7+ tags :
8+ - Java
9+ - Difficulty-Beginner
10+ - Idiom
11+ ---
12+
13+ ## Intent
14+ Provide a template to supress any exceptions that either are declared but cannot occur or should only be logged;
15+ while executing some business logic. The template removes the need to write repeated ` try-catch ` blocks.
16+
17+
18+ ![ alt text] ( ./etc/mute-idiom.png " Mute Idiom ")
19+
20+ ## Applicability
21+ Use this idiom when
22+
23+ * an API declares some exception but can never throw that exception. Eg. ByteArrayOutputStream bulk write method.
24+ * you need to suppress some exception just by logging it, such as closing a resource.
25+
26+ ## Credits
27+
28+ * [ JOOQ: Mute Design Pattern] ( http://blog.jooq.org/2016/02/18/the-mute-design-pattern/ )
You can’t perform that action at this time.
0 commit comments