NlmLock implements Serializable { public boolean isConflictingType(NlmLock other) { return lockType == nfs_lock_type4 .WRITE_LT || lockType == nfs_lock_type4 .WRITEW_LT || other.lockType == nfs_lock_type4 .WRITE_LT || other.lockType == nfs_lock_type4 .WRITEW_LT; } NlmLock(StateOwner owner, int lockType, long offset, long length); StateOwner getOwner(); long getOffset(); long getLength(); int getLockType(); @Override int hashCode(); @Override boolean equals(Object obj); boolean isSameOwner(NlmLock other); boolean isOverlappingRange(NlmLock other); boolean isConflictingType(NlmLock other); boolean isConflicting(NlmLock other); @Override String toString();  }
@Test public void shouldConflictOnReadWriteLocks() { NlmLock lock1 = new NlmLock(lo1, nfs_lock_type4.WRITE_LT, 0, nfs4_prot.NFS4_UINT64_MAX); NlmLock lock2 = new NlmLock(lo2, nfs_lock_type4.READ_LT, 0, nfs4_prot.NFS4_UINT64_MAX); assertTrue("read+write locks must conflict", lock1.isConflictingType(lock2)); }