![JAR search and dependency download from the Maven repository](/logo.png)
io.agroal.test.AgroalTestHelper Maven / Gradle / Ivy
// Copyright (C) 2017 Red Hat, Inc. and individual contributors as indicated by the @author tags.
// You may not use this file except in compliance with the Apache License, Version 2.0.
package io.agroal.test;
import java.time.Duration;
import static java.lang.System.nanoTime;
import static java.lang.Thread.sleep;
/**
* @author Luis Barreiro
*/
public class AgroalTestHelper {
private AgroalTestHelper() {
}
public static void safeSleep(Duration duration) {
long target = nanoTime() + duration.toNanos();
do {
try {
sleep( duration.toMillis() );
} catch ( InterruptedException e ) {
// retry
}
} while ( nanoTime() < target );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy