Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed delay to Duration instead of long
Browse files Browse the repository at this point in the history
kevinrr888 committed Sep 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9599bd8 commit f7556c9
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions core/src/main/java/org/apache/accumulo/core/fate/Fate.java
Original file line number Diff line number Diff line change
@@ -384,7 +384,7 @@ public Fate(T environment, FateStore<T> store, boolean runDeadResCleaner,
deadResCleanerExecutor = ThreadPools.getServerThreadPools().createScheduledExecutorService(1,
store.type() + "-dead-reservation-cleaner-pool");
ScheduledFuture<?> deadReservationCleaner = deadResCleanerExecutor.scheduleWithFixedDelay(
new DeadReservationCleaner(), 3, getDeadResCleanupDelay(), SECONDS);
new DeadReservationCleaner(), 3, getDeadResCleanupDelay().toSeconds(), SECONDS);
ThreadPools.watchCriticalScheduledTask(deadReservationCleaner);
}
this.deadResCleanerExecutor = deadResCleanerExecutor;
@@ -393,8 +393,8 @@ public Fate(T environment, FateStore<T> store, boolean runDeadResCleaner,
this.workFinder.start();
}

protected long getDeadResCleanupDelay() {
return 180;
public Duration getDeadResCleanupDelay() {
return Duration.ofMinutes(3);
}

// get a transaction id back to the requester before doing any work
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
*/
package org.apache.accumulo.test.fate;

import java.time.Duration;
import java.util.function.Function;

import org.apache.accumulo.core.conf.AccumuloConfiguration;
@@ -29,15 +30,14 @@
* A FATE which performs the dead reservation cleanup with a much shorter delay between
*/
public class FastFate<T> extends Fate<T> {
public static final long delay = 15;

public FastFate(T environment, FateStore<T> store, boolean runDeadResCleaner,
Function<Repo<T>,String> toLogStrFunc, AccumuloConfiguration conf) {
super(environment, store, runDeadResCleaner, toLogStrFunc, conf);
}

@Override
protected long getDeadResCleanupDelay() {
return delay;
public Duration getDeadResCleanupDelay() {
return Duration.ofSeconds(15);
}
}
Original file line number Diff line number Diff line change
@@ -458,7 +458,7 @@ private void testDeadReservationsCleanup(FateInstanceType storeType) throws Exce
boolean allReservedWithLock2 = store2Reservations.values().stream()
.allMatch(entry -> FateStore.FateReservation.locksAreEqual(entry.getLockID(), lock2));
return store2Reservations.keySet().equals(allIds) && allReservedWithLock2;
}, FastFate.delay * 2 * 1000);
}, fate1.getDeadResCleanupDelay().toMillis() * 2);

// Finish work and shutdown
testEnv1.workersLatch.countDown();

0 comments on commit f7556c9

Please sign in to comment.