Skip to content

Commit 6d1e9c0

Browse files
committed
Rename sleep to pause so that superclass method is not invoked prior to static method.
1 parent b8f553b commit 6d1e9c0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public void test() throws Exception {
269269
while (failed.get() == false && System.nanoTime() < endTime) {
270270

271271
// Wait a bit:
272-
sleep(TestUtil.nextInt(random(), Math.min(runTimeSec * 4, 200), runTimeSec * 4));
272+
pause(TestUtil.nextInt(random(), Math.min(runTimeSec * 4, 200), runTimeSec * 4));
273273
if (primary != null && random().nextBoolean()) {
274274
NodeProcess curPrimary = primary;
275275
if (curPrimary != null) {
@@ -672,7 +672,7 @@ NodeProcess startNode(final int id, Path indexPath, boolean isPrimary, long forc
672672
return null;
673673
} else {
674674
try {
675-
sleep(10);
675+
pause(10);
676676
} catch (InterruptedException ie) {
677677
throw new ThreadInterruptedException(ie);
678678
}
@@ -722,7 +722,7 @@ NodeProcess startNode(final int id, Path indexPath, boolean isPrimary, long forc
722722
() -> {
723723
while (System.nanoTime() < deadline && p.isAlive()) {
724724
try {
725-
sleep(250);
725+
pause(250);
726726
} catch (
727727
@SuppressWarnings("unused")
728728
InterruptedException e) {
@@ -815,7 +815,7 @@ NodeProcess startNode(final int id, Path indexPath, boolean isPrimary, long forc
815815
}
816816

817817
@SuppressForbidden(reason = "Thread sleep")
818-
private static void sleep(int millis) throws InterruptedException {
818+
private static void pause(int millis) throws InterruptedException {
819819
Thread.sleep(millis);
820820
}
821821

@@ -909,7 +909,7 @@ public void run() {
909909

910910
try {
911911
while (stop.get() == false) {
912-
sleep(TestUtil.nextInt(random(), 50, 500));
912+
pause(TestUtil.nextInt(random(), 50, 500));
913913
// message("top: restarter cycle");
914914

915915
// Randomly crash full cluster:
@@ -919,7 +919,7 @@ public void run() {
919919
if (starting[i]) {
920920
message("N" + i + ": top: wait for startup so we can crash...");
921921
while (starting[i]) {
922-
sleep(10);
922+
pause(10);
923923
}
924924
message("N" + i + ": top: done wait for startup");
925925
}
@@ -1015,7 +1015,7 @@ public void run() {
10151015
message("Restarter: now stop: join " + startupThreads.size() + " startup threads");
10161016

10171017
while (!startupThreads.isEmpty()) {
1018-
sleep(1000);
1018+
pause(1000);
10191019
message("Waiting for startup threads to terminate.");
10201020
}
10211021
} catch (Throwable t) {
@@ -1077,7 +1077,7 @@ public void run() {
10771077
if (node.isOpen == false) {
10781078
throw new IOException("node closed");
10791079
}
1080-
sleep(1);
1080+
pause(1);
10811081
}
10821082
version = c.in.readVLong();
10831083

@@ -1088,7 +1088,7 @@ public void run() {
10881088
if (node.isOpen == false) {
10891089
throw new IOException("node closed");
10901090
}
1091-
sleep(1);
1091+
pause(1);
10921092
}
10931093
int hitCount = c.in.readVInt();
10941094

@@ -1164,7 +1164,7 @@ && random().nextInt(10) == 7) {
11641164
if (node.isOpen == false) {
11651165
throw new IOException("node died");
11661166
}
1167-
sleep(1);
1167+
pause(1);
11681168
}
11691169

11701170
version = c.in.readVLong();
@@ -1176,7 +1176,7 @@ && random().nextInt(10) == 7) {
11761176
if (node.isOpen == false) {
11771177
throw new IOException("node died");
11781178
}
1179-
sleep(1);
1179+
pause(1);
11801180
}
11811181

11821182
int hitCount = c.in.readVInt();
@@ -1211,7 +1211,7 @@ && random().nextInt(10) == 7) {
12111211
}
12121212
}
12131213

1214-
sleep(10);
1214+
pause(10);
12151215

12161216
} catch (Throwable t) {
12171217
failed.set(true);
@@ -1250,7 +1250,7 @@ public void run() {
12501250

12511251
try {
12521252
while (stop.get() == false && curPrimary == null) {
1253-
sleep(10);
1253+
pause(10);
12541254
curPrimary = primary;
12551255
if (curPrimary != null) {
12561256
c = new Connection(curPrimary.tcpPort);
@@ -1320,13 +1320,13 @@ public void run() {
13201320
}
13211321

13221322
if (random().nextInt(sleepChance) == 0) {
1323-
sleep(10);
1323+
pause(10);
13241324
}
13251325

13261326
if (random().nextInt(100) == 17) {
13271327
int pauseMS = TestUtil.nextInt(random(), 500, 2000);
13281328
message("Indexer: now pause for " + pauseMS + " ms...");
1329-
sleep(pauseMS);
1329+
pause(pauseMS);
13301330
message("Indexer: done pause for a bit...");
13311331
}
13321332
}

0 commit comments

Comments
 (0)