本文整理了Java中java.nio.channels.FileLock.overlaps()
方法的一些代码示例,展示了FileLock.overlaps()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileLock.overlaps()
方法的具体详情如下:
包路径:java.nio.channels.FileLock
类名称:FileLock
方法名:overlaps
[英]Indicates if the receiver's lock region overlaps the region described in the parameter list.
[中]指示接收器的锁定区域是否与参数列表中描述的区域重叠。
代码示例来源:origin: robovm/robovm
/**
* 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);
}
代码示例来源:origin: MobiVM/robovm
/**
* 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);
}
代码示例来源:origin: ibinti/bugvm
/**
* 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);
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* 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);
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* 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);
}
代码示例来源:origin: FlexoVM/flexovm
/**
* 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);
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* 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);
}
内容来源于网络,如有侵权,请联系作者删除!