ThreadDumpEndpointTests.java (spring-boot-2.7.3) | : | ThreadDumpEndpointTests.java (spring-boot-2.7.4) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2012-2019 the original author or authors. | * Copyright 2012-2022 the original author or authors. | |||
* | * | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 108 | skipping to change at line 108 | |||
synchronized (monitor) { | synchronized (monitor) { | |||
monitor.notifyAll(); | monitor.notifyAll(); | |||
} | } | |||
assertThat(threadDump) | assertThat(threadDump) | |||
.containsPattern(String.format("\t- parking to wa it for <[0-9a-z]+> \\(a %s\\$Sync\\)", | .containsPattern(String.format("\t- parking to wa it for <[0-9a-z]+> \\(a %s\\$Sync\\)", | |||
CountDownLatch.class.getName().re place(".", "\\."))) | CountDownLatch.class.getName().re place(".", "\\."))) | |||
.contains(String.format("\t- locked <%s> (a java. lang.Object)", hexIdentityHashCode(contendedMonitor))) | .contains(String.format("\t- locked <%s> (a java. lang.Object)", hexIdentityHashCode(contendedMonitor))) | |||
.contains(String.format("\t- waiting to lock <%s> (a java.lang.Object) owned by \"%s\" t@%d", | .contains(String.format("\t- waiting to lock <%s> (a java.lang.Object) owned by \"%s\" t@%d", | |||
hexIdentityHashCode(contendedMoni tor), Thread.currentThread().getName(), | hexIdentityHashCode(contendedMoni tor), Thread.currentThread().getName(), | |||
Thread.currentThread().getId())) | Thread.currentThread().getId())) | |||
.contains(String.format("\t- waiting on <%s> (a j | .satisfiesAnyOf( | |||
ava.lang.Object)", hexIdentityHashCode(monitor))) | (dump) -> dump.contains(String.fo | |||
rmat("\t- waiting on <%s> (a java.lang.Object)", | ||||
hexIdentityHashCo | ||||
de(monitor))), | ||||
(dump) -> dump.contains(String.fo | ||||
rmat("\t- parking to wait for <%s> (a java.lang.Object)", | ||||
hexIdentityHashCo | ||||
de(monitor)))) | ||||
.containsPattern( | .containsPattern( | |||
String.format("Locked ownable syn chronizers:%n\t- Locked <[0-9a-z]+> \\(a %s\\$NonfairSync\\)", | String.format("Locked ownable syn chronizers:%n\t- Locked <[0-9a-z]+> \\(a %s\\$NonfairSync\\)", | |||
ReentrantReadWrit eLock.class.getName().replace(".", "\\."))); | ReentrantReadWrit eLock.class.getName().replace(".", "\\."))); | |||
} | } | |||
private String hexIdentityHashCode(Object object) { | private String hexIdentityHashCode(Object object) { | |||
return Integer.toHexString(System.identityHashCode(object)); | return Integer.toHexString(System.identityHashCode(object)); | |||
} | } | |||
private void awaitState(Thread thread, State state) throws InterruptedExc eption { | private void awaitState(Thread thread, State state) throws InterruptedExc eption { | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added |