puzhibing
2023-10-08 22199bbdda579861736420fe26c2873ab0f5d21c
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
36
package com.sinata.rest.common.lock;
 
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
 
public class IdLock {
 
    public final AtomicInteger count = new AtomicInteger(Integer.MAX_VALUE);
 
    private Integer id;
 
    public IdLock(Integer id) {
        this.id = id;
    }
 
    public Integer getId() {
        return id;
    }
 
    public void setId(Integer id) {
        this.id = id;
    }
 
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IdLock idLock = (IdLock) o;
        return id.equals(idLock.id);
    }
 
    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}