private void setPart(LockComponent comp, PartTrie parts) { LockComponent existing = parts.get(comp.getPartitionname()); if (existing == null) { // No existing lock for this partition. parts.put(comp.getPartitionname(), comp); } else if (existing.getType() != LockType.EXCLUSIVE && (comp.getType() == LockType.EXCLUSIVE || comp.getType() == LockType.SHARED_WRITE)) { // We only need to promote if comp.type is > existing.type. For // efficiency we check if existing is exclusive (in which case we // need never promote) or if comp is exclusive or shared_write (in // which case we can promote even though they may both be shared // write). If comp is shared_read there's never a need to promote. parts.put(comp.getPartitionname(), comp); } }
private void setPart(LockComponent comp, PartTrie parts) { LockComponent existing = parts.get(comp.getPartitionname()); if (existing == null) { // No existing lock for this partition. parts.put(comp.getPartitionname(), comp); } else if (existing.getType() != LockType.EXCLUSIVE && (comp.getType() == LockType.EXCLUSIVE || comp.getType() == LockType.SHARED_WRITE)) { // We only need to promote if comp.type is > existing.type. For // efficiency we check if existing is exclusive (in which case we // need never promote) or if comp is exclusive or shared_write (in // which case we can promote even though they may both be shared // write). If comp is shared_read there's never a need to promote. parts.put(comp.getPartitionname(), comp); } }
private void setPart(LockComponent comp, PartTrie parts) { LockComponent existing = parts.get(comp.getPartitionname()); if (existing == null) { // No existing lock for this partition. parts.put(comp.getPartitionname(), comp); } else if (existing.getType() != LockType.EXCLUSIVE && (comp.getType() == LockType.EXCLUSIVE || comp.getType() == LockType.SHARED_WRITE)) { // We only need to promote if comp.type is > existing.type. For // efficiency we check if existing is exclusive (in which case we // need never promote) or if comp is exclusive or shared_write (in // which case we can promote even though they may both be shared // write). If comp is shared_read there's never a need to promote. parts.put(comp.getPartitionname(), comp); } }
private void setPart(LockComponent comp, PartTrie parts) { LockComponent existing = parts.get(comp.getPartitionname()); if (existing == null) { // No existing lock for this partition. parts.put(comp.getPartitionname(), comp); } else if (existing.getType() != LockType.EXCLUSIVE && (comp.getType() == LockType.EXCLUSIVE || comp.getType() == LockType.SHARED_WRITE)) { // We only need to promote if comp.type is > existing.type. For // efficiency we check if existing is exclusive (in which case we // need never promote) or if comp is exclusive or shared_write (in // which case we can promote even though they may both be shared // write). If comp is shared_read there's never a need to promote. parts.put(comp.getPartitionname(), comp); } }