2017-01-06 01:20:59 +01:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Balking
|
|
|
|
folder: balking
|
|
|
|
permalink: /patterns/balking/
|
|
|
|
categories: Concurrency
|
|
|
|
tags:
|
2019-12-13 21:09:28 +02:00
|
|
|
- Decoupling
|
2017-01-06 01:20:59 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
## Intent
|
|
|
|
Balking Pattern is used to prevent an object from executing certain code if it is an
|
|
|
|
incomplete or inappropriate state
|
|
|
|
|
2019-12-07 20:01:13 +02:00
|
|
|
## Class diagram
|
2017-01-06 01:20:59 +01:00
|
|
|

|
|
|
|
|
|
|
|
## Applicability
|
|
|
|
Use the Balking pattern when
|
|
|
|
|
2017-09-26 20:51:32 +02:00
|
|
|
* you want to invoke an action on an object only when it is in a particular state
|
|
|
|
* objects are generally only in a state that is prone to balking temporarily
|
2017-03-13 01:33:14 +01:00
|
|
|
but for an unknown amount of time
|
|
|
|
|
|
|
|
## Related patterns
|
2017-08-31 01:50:33 +05:30
|
|
|
* Guarded Suspension Pattern
|
2017-09-26 20:51:32 +02:00
|
|
|
* Double Checked Locking Pattern
|