"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-core/src/testFixtures/java/org/springframework/core/testfixture/io/buffer/LeakAwareDataBufferFactory.java" between
spring-framework-5.3.23.tar.gz and spring-framework-5.3.24.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

LeakAwareDataBufferFactory.java  (spring-framework-5.3.23):LeakAwareDataBufferFactory.java  (spring-framework-5.3.24)
skipping to change at line 81 skipping to change at line 81
Assert.notNull(delegate, "Delegate must not be null"); Assert.notNull(delegate, "Delegate must not be null");
this.delegate = delegate; this.delegate = delegate;
} }
/** /**
* Checks whether all the data buffers allocated by this factory have als o been released. * Checks whether all the data buffers allocated by this factory have als o been released.
* If not, then an {@link AssertionError} is thrown. Typically used from a JUnit <em>after</em> * If not, then an {@link AssertionError} is thrown. Typically used from a JUnit <em>after</em>
* method. * method.
*/ */
public void checkForLeaks() { public void checkForLeaks() {
checkForLeaks(Duration.ofSeconds(0));
}
/**
* Variant of {@link #checkForLeaks()} with the option to wait for buffer
release.
* @param timeout how long to wait for buffers to be released; 0 for no w
aiting
*/
public void checkForLeaks(Duration timeout) {
this.trackCreated.set(false); this.trackCreated.set(false);
Instant start = Instant.now(); Instant start = Instant.now();
while (true) { while (true) {
if (this.created.stream().noneMatch(LeakAwareDataBuffer:: isAllocated)) { if (this.created.stream().noneMatch(LeakAwareDataBuffer:: isAllocated)) {
return; return;
} }
if (Instant.now().isBefore(start.plus(Duration.ofSeconds( 5)))) { if (Instant.now().isBefore(start.plus(timeout))) {
try { try {
Thread.sleep(50); Thread.sleep(50);
} }
catch (InterruptedException ex) { catch (InterruptedException ex) {
// ignore // ignore
} }
continue; continue;
} }
List<AssertionError> errors = this.created.stream() List<AssertionError> errors = this.created.stream()
.filter(LeakAwareDataBuffer::isAllocated) .filter(LeakAwareDataBuffer::isAllocated)
 End of changes. 2 change blocks. 
1 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)