Files
_scripts
abstract-document
abstract-factory
adapter
aggregator-microservices
api-gateway
async-method-invocation
balking
bridge
builder
business-delegate
caching
callback
chain
command
composite
converter
cqrs
dao
data-bus
data-mapper
data-transfer-object
decorator
delegation
dependency-injection
double-checked-locking
double-dispatch
eip-splitter
eip-wire-tap
event-aggregator
event-asynchronous
event-driven-architecture
event-queue
event-sourcing
execute-around
etc
src
README.md
pom.xml
extension-objects
facade
factory-kit
factory-method
feature-toggle
fluentinterface
flux
flyweight
front-controller
guarded-suspension
half-sync-half-async
hexagonal
intercepting-filter
interpreter
iterator
layers
lazy-loading
marker
mediator
memento
message-channel
model-view-controller
model-view-presenter
module
monad
monostate
multiton
mute-idiom
mutex
naked-objects
null-object
object-mother
object-pool
observer
page-object
partial-response
poison-pill
private-class-data
producer-consumer
promise
property
prototype
proxy
publish-subscribe
queue-load-leveling
reactor
reader-writer-lock
repository
resource-acquisition-is-initialization
semaphore
servant
service-layer
service-locator
singleton
specification
state
step-builder
strategy
template-method
thread-pool
throttling
tls
tolerant-reader
twin
value-object
visitor
.gitignore
.travis.yml
CODE_COVERAGE.md
CONTRIBUTING.MD
LICENSE.md
README.md
checkstyle-suppressions.xml
checkstyle.xml
exclude-pmd.properties
faq.md
pom.xml
update-ghpages.sh
java-design-patterns/execute-around/README.md

29 lines
976 B
Markdown
Raw Normal View History

---
layout: pattern
title: Execute Around
folder: execute-around
permalink: /patterns/execute-around/
pumlid: NSZ14G8n20NGLhI0XBlT865suoGa0n_NylNixSsxTvEHJTF7xGHsF8YShtfqdFdCK9TbK4ELDQcFl1ZizE8tbwRH3okR0NKBcXm_a7vK4bhOLreZXVnLJPzrvnnV
categories: Other
2015-12-28 15:52:44 +02:00
tags:
- Java
- Difficulty-Beginner
- Idiom
---
## 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.
![alt text](./etc/execute-around.png "Execute Around")
## Applicability
Use the Execute Around idiom when
* you use an API that requires methods to be called in pairs such as open/close or allocate/deallocate.
## Credits
* [Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions](http://www.amazon.com/Functional-Programming-Java-Harnessing-Expressions/dp/1937785467/ref=sr_1_1)