/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }
/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }
/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }
/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }
/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }
/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }
/** * Add a new pending lock to the manager. Throws an exception if the lock * would overlap an existing lock. Once the lock is acquired it remains in * this set as an acquired lock. */ private synchronized void addLock(FileLock lock) throws OverlappingFileLockException { long lockEnd = lock.position() + lock.size(); for (FileLock existingLock : locks) { if (existingLock.position() > lockEnd) { // This, and all remaining locks, start beyond our end (so // cannot overlap). break; } if (existingLock.overlaps(lock.position(), lock.size())) { throw new OverlappingFileLockException(); } } locks.add(lock); }