use of com.thinkaurelius.titan.diskstorage.locking.consistentkey.StandardLockCleanerService in project titan by thinkaurelius.
the class LockCleanerServiceTest method testCleanCooldownElapses.
@Test
public void testCleanCooldownElapses() throws InterruptedException {
final Instant cutoff = Instant.ofEpochMilli(1L);
Duration wait = Duration.ofMillis(500L);
svc = new StandardLockCleanerService(store, codec, exec, wait, TimestampProviders.MILLI);
expect(exec.submit(eq(new StandardLockCleanerRunnable(store, kc, tx, codec, cutoff, TimestampProviders.MILLI)))).andReturn(null);
expect(exec.submit(eq(new StandardLockCleanerRunnable(store, kc, tx, codec, cutoff.plusMillis(1), TimestampProviders.MILLI)))).andReturn(null);
ctrl.replay();
for (int i = 0; i < 2; i++) {
svc.clean(kc, cutoff, tx);
}
TimestampProviders.MILLI.sleepFor(wait.plusMillis(1));
for (int i = 0; i < 2; i++) {
svc.clean(kc, cutoff.plusMillis(1), tx);
}
}
use of com.thinkaurelius.titan.diskstorage.locking.consistentkey.StandardLockCleanerService in project titan by thinkaurelius.
the class LockCleanerServiceTest method testCleanCooldownBlocksRapidRequests.
@Test
public void testCleanCooldownBlocksRapidRequests() {
final Instant cutoff = Instant.ofEpochMilli(1L);
svc = new StandardLockCleanerService(store, codec, exec, Duration.ofSeconds(60L), TimestampProviders.MILLI);
expect(exec.submit(eq(new StandardLockCleanerRunnable(store, kc, tx, codec, cutoff, TimestampProviders.MILLI)))).andReturn(null);
ctrl.replay();
for (int i = 0; i < 500; i++) {
svc.clean(kc, cutoff, tx);
}
}
Aggregations