Skip to content

Commit a395316

Browse files
committed
Added readme
1 parent 80875a9 commit a395316

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

mute-idiom/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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/)

0 commit comments

Comments
 (0)