Adapt to latest changes in the locking model for context close
See gh-38666
This commit is contained in:
		
							parent
							
								
									60ebb32e8a
								
							
						
					
					
						commit
						8c5b7a87ae
					
				| 
						 | 
					@ -22,6 +22,7 @@ import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.concurrent.CopyOnWriteArrayList;
 | 
					import java.util.concurrent.CopyOnWriteArrayList;
 | 
				
			||||||
import java.util.concurrent.CountDownLatch;
 | 
					import java.util.concurrent.CountDownLatch;
 | 
				
			||||||
 | 
					import java.util.concurrent.TimeUnit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.awaitility.Awaitility;
 | 
					import org.awaitility.Awaitility;
 | 
				
			||||||
import org.junit.jupiter.api.Test;
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
| 
						 | 
					@ -113,7 +114,7 @@ class SpringApplicationShutdownHookTests {
 | 
				
			||||||
		Thread shutdownThread = new Thread(shutdownHook);
 | 
							Thread shutdownThread = new Thread(shutdownHook);
 | 
				
			||||||
		shutdownThread.start();
 | 
							shutdownThread.start();
 | 
				
			||||||
		// Shutdown thread should start waiting for context to become inactive
 | 
							// Shutdown thread should start waiting for context to become inactive
 | 
				
			||||||
		Awaitility.await().atMost(Duration.ofSeconds(30)).until(shutdownThread::getState, State.TIMED_WAITING::equals);
 | 
							Awaitility.await().atMost(Duration.ofSeconds(30)).until(shutdownThread::getState, State.WAITING::equals);
 | 
				
			||||||
		// Allow context thread to proceed, unblocking shutdown thread
 | 
							// Allow context thread to proceed, unblocking shutdown thread
 | 
				
			||||||
		proceedWithClose.countDown();
 | 
							proceedWithClose.countDown();
 | 
				
			||||||
		contextThread.join();
 | 
							contextThread.join();
 | 
				
			||||||
| 
						 | 
					@ -252,7 +253,7 @@ class SpringApplicationShutdownHookTests {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (this.proceedWithClose != null) {
 | 
								if (this.proceedWithClose != null) {
 | 
				
			||||||
				try {
 | 
									try {
 | 
				
			||||||
					this.proceedWithClose.await();
 | 
										this.proceedWithClose.await(1, TimeUnit.MINUTES);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				catch (InterruptedException ex) {
 | 
									catch (InterruptedException ex) {
 | 
				
			||||||
					Thread.currentThread().interrupt();
 | 
										Thread.currentThread().interrupt();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue