HDFS-14843. Double Synchronization in BlockReportLeaseManager. Contributed by David Mollitor.

This commit is contained in:
Inigo Goiri 2019-09-24 09:58:42 -07:00
parent 816d3cb908
commit afa1006a53

View File

@ -180,12 +180,8 @@ void addToBeginning(NodeData node) {
/**
* Get the next block report lease ID. Any number is valid except 0.
*/
private synchronized long getNextId() {
long id;
do {
id = nextId++;
} while (id == 0);
return id;
private long getNextId() {
return ++nextId == 0L ? ++nextId : nextId;
}
public synchronized void register(DatanodeDescriptor dn) {