blob: 28c701a67db4c4a2813f9f94f70dfeb22d4184bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.concurrent.maintenance;
import com.yahoo.transaction.Mutex;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* @author mpolden
*/
class JobControlStateMock implements JobControlState {
private final Set<String> inactiveJobs = new HashSet<>();
@Override
public Set<String> readInactiveJobs() {
return Collections.unmodifiableSet(inactiveJobs);
}
@Override
public Mutex lockMaintenanceJob(String job) {
return () -> {};
}
public void setActive(String job, boolean active) {
if (active) {
inactiveJobs.remove(job);
} else {
inactiveJobs.add(job);
}
}
}
|