Java 8 OverlappingFileLockException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 OverlappingFileLockException class.

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.OverlappingFileLockException#OverlappingFileLockException()} 
     */ 
    public void test_Constructor() { 
        OverlappingFileLockException e = new OverlappingFileLockException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new OverlappingFileLockException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.OverlappingFileLockException#OverlappingFileLockException()} 
     */ 
    public void test_Constructor() { 
        OverlappingFileLockException e = new OverlappingFileLockException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:toString
      else 
        _fileLock = _fileChannel.tryLock(0, Long.MAX_VALUE, false);
 
      return _fileLock != null;
    } catch (OverlappingFileLockException e) {
      log.log(Level.FINE, e.toString(), e);
      return false; 
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
      return false; 
    } 
  } 
 
  public boolean unlock() 
  { 
    try { 
      FileLock lock = _fileLock;
      _fileLock = null;
 
      if (lock != null) {
4
CodeRank
This code example shows how to use the following methods:toString
      else 
        _fileLock = _fileChannel.tryLock(0, Long.MAX_VALUE, false);
 
      return _fileLock != null;
    } catch (OverlappingFileLockException e) {
      log.log(Level.FINE, e.toString(), e);
      return false; 
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
      return false; 
    } 
  } 
 
  public boolean unlock() 
  { 
    try { 
      FileLock lock = _fileLock;
      _fileLock = null;
 
      if (lock != null) {
4
CodeRank
This code example shows how to use the following methods:
    if (Thread.currentThread().isInterrupted()) {
      throw new FileLockInterruptionException();
    } 
    MemoryFileLock returnValue = this.tryLock(lock);
    if (returnValue == null) {
      throw new OverlappingFileLockException();
    } 
    return returnValue;
  } 
 
  void remove(MemoryFileLock lock) {
    // no need to check for return value because FileLock#release 
    // can be invoked several times from multiple threads 
    this.locks.remove(lock.position());
    lock.invalidate();
  } 
 
} 
3
CodeRank
This code example shows how to use the following methods:toString
      else 
        _fileLock = _fileChannel.tryLock(0, Long.MAX_VALUE, false);
 
      return _fileLock != null;
    } catch (OverlappingFileLockException e) {
      log.log(Level.FINE, e.toString(), e);
      return false; 
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
      return false; 
    } 
  } 
 
  public boolean unlock() 
  { 
    try { 
      FileLock lock = _fileLock;
      _fileLock = null;
 
      if (lock != null) {
3
CodeRank
See Code Examples for Java 8 OverlappingFileLockException Methods: