Skip to content

Commit

Permalink
test: rmi: Wait for up to 5 seconds instead of 500ms
Browse files Browse the repository at this point in the history
testRemoteShutdownNotAllowed may erroneously fail on a busy machine.
  • Loading branch information
kohlschuetter committed Apr 19, 2024
1 parent a419960 commit 813f25a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,24 @@ protected int shutdownAfterSecs() {
assertThrows(ServerException.class, () -> sra.getRegistry().getNaming().shutdownRegistry());

sra.shutdownAndWait(false);
if (!awaitNoRMIFiles(socketDir, 5)) {
if (!awaitNoRMIFiles(socketDir)) {
sra.shutdownAndWait(true);
}
} catch (Exception e) {
throw e;
}

assertTrue(awaitNoRMIFiles(socketDir, 5), "There shouldn't be any RMI socket files in "
assertTrue(awaitNoRMIFiles(socketDir), "There shouldn't be any RMI socket files in "
+ socketDir);
} finally {
assertTrue(deleteDirectory(socketDir), "Should be able to delete temporary directory: "
+ socketDir);
}
}

private boolean awaitNoRMIFiles(File socketDir, int loops) throws InterruptedException {
private boolean awaitNoRMIFiles(File socketDir) throws InterruptedException {
int count = 0;
for (int i = 0; i < loops; i++) {
for (int i = 0; i < 50; i++) {
count = countRMIFiles(socketDir);
if (count == 0) {
return true;
Expand Down

0 comments on commit 813f25a

Please sign in to comment.