2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Execute Around
|
|
|
|
folder: execute-around
|
2015-08-15 18:03:05 +02:00
|
|
|
permalink: /patterns/execute-around/
|
2015-08-20 21:40:07 +02:00
|
|
|
categories: Other
|
2015-12-28 15:52:44 +02:00
|
|
|
tags:
|
|
|
|
- Java
|
|
|
|
- Difficulty-Beginner
|
|
|
|
- Idiom
|
2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
**Intent:** Execute Around idiom frees the user from certain actions that
|
|
|
|
should always be executed before and after the business method. A good example
|
|
|
|
of this is resource allocation and deallocation leaving the user to specify
|
|
|
|
only what to do with the resource.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
**Applicability:** Use the Execute Around idiom when
|
|
|
|
|
2015-08-15 18:03:05 +02:00
|
|
|
* you use an API that requires methods to be called in pairs such as open/close or allocate/deallocate.
|