Skip to content

Commit 59c66ea

Browse files
committed
Correct documented path for locked synchronizer's identity hashcode
Closes gh-15847
1 parent ebcc53a commit 59c66ea

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/ThreadDumpEndpointDocumentationTests.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,9 @@
1616

1717
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
1818

19+
import java.util.concurrent.CountDownLatch;
20+
import java.util.concurrent.locks.ReentrantLock;
21+
1922
import org.junit.Test;
2023

2124
import org.springframework.boot.actuate.management.ThreadDumpEndpoint;
@@ -42,6 +45,22 @@ public class ThreadDumpEndpointDocumentationTests
4245

4346
@Test
4447
public void threadDump() throws Exception {
48+
ReentrantLock lock = new ReentrantLock();
49+
CountDownLatch latch = new CountDownLatch(1);
50+
new Thread(() -> {
51+
try {
52+
lock.lock();
53+
try {
54+
latch.await();
55+
}
56+
finally {
57+
lock.unlock();
58+
}
59+
}
60+
catch (InterruptedException ex) {
61+
Thread.currentThread().interrupt();
62+
}
63+
}).start();
4564
this.mockMvc.perform(get("/actuator/threaddump")).andExpect(status().isOk())
4665
.andDo(MockMvcRestDocumentation.document("threaddump",
4766
preprocessResponse(limit("threads")),
@@ -111,7 +130,7 @@ public void threadDump() throws Exception {
111130
+ "synchronizer.")
112131
.optional().type(JsonFieldType.STRING),
113132
fieldWithPath(
114-
"threads.[].lockedSynchronizers.[].identifyHashCode")
133+
"threads.[].lockedSynchronizers.[].identityHashCode")
115134
.description(
116135
"Identity hash code of the locked "
117136
+ "synchronizer.")
@@ -187,6 +206,7 @@ public void threadDump() throws Exception {
187206
"Time in milliseconds that the thread has spent "
188207
+ "waiting. -1 if thread contention "
189208
+ "monitoring is disabled"))));
209+
latch.countDown();
190210
}
191211

192212
@Configuration

0 commit comments

Comments
 (0)