| 
									
										
										
										
											2017-01-06 00:57:47 +01:00
										 |  |  | --- | 
					
						
							|  |  |  | layout: pattern | 
					
						
							|  |  |  | title: Guarded Suspension | 
					
						
							|  |  |  | folder: guarded-suspension | 
					
						
							|  |  |  | permalink: /patterns/guarded-suspension/ | 
					
						
							|  |  |  | categories: Concurrency | 
					
						
							|  |  |  | tags: | 
					
						
							| 
									
										
										
										
											2019-12-13 21:09:28 +02:00
										 |  |  |  - Decoupling | 
					
						
							| 
									
										
										
										
											2017-01-06 00:57:47 +01:00
										 |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Intent
 | 
					
						
							| 
									
										
										
										
											2017-02-28 15:06:50 +01:00
										 |  |  | Use Guarded suspension pattern to handle a situation when you want to execute a method on object which is not in a proper state. | 
					
						
							| 
									
										
										
										
											2017-01-06 01:01:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-07 20:01:13 +02:00
										 |  |  | ## Class diagram
 | 
					
						
							| 
									
										
										
										
											2017-01-06 00:57:47 +01:00
										 |  |  |  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Applicability
 | 
					
						
							| 
									
										
										
										
											2017-02-28 15:06:50 +01:00
										 |  |  | Use Guarded Suspension pattern when the developer knows that the method execution will be blocked for a finite period of time | 
					
						
							| 
									
										
										
										
											2017-01-06 00:57:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-28 15:06:50 +01:00
										 |  |  | ## Related patterns
 | 
					
						
							| 
									
										
										
										
											2019-12-13 21:09:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-28 15:06:50 +01:00
										 |  |  | * Balking  |