1
zj
2024-08-10 c47543cbe3f6683567c9398a204a86dc192a9608
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package project.loan;
 
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
 
public class LoanLock {
    private static final Set<String> filter = Collections.synchronizedSet(new HashSet<String>());
 
    public static boolean add(String partyId) {
        if (!filter.add(partyId)) {
            return false;
        } else {
            return true;
        }
    }
 
    public static void remove(String partyId) {
        filter.remove(partyId);
    }
}