Package java.nio.channels

Examples of java.nio.channels.FileLock.release()


                writable = false;
            } finally {
                if (lock != null) {
                    writable = true;
                    try {
                        lock.release();
                    } catch (IOException e) {
                        log.warn("Error while releasing the lock on file: " + file.getName(), e);
                        writable = false;
                    }
                } else {
View Full Code Here


                }
              }
            }

          } finally {
            if (lock != null) lock.release();
            if (fstream != null) fstream.close();
          }
          uraf = new ucar.unidata.io.RandomAccessFile(uncompressedFile.getPath(), "r");

        } else {
View Full Code Here

          throw new RuntimeException(e);
      }

    } finally {
      if (null != outputRaf) outputRaf.flush();
      if (lock != null) lock.release();
    }

    return outputRaf;
  }
View Full Code Here

      try {
        FileLock fileLock = raf.getChannel().tryLock();

        if (fileLock != null) {
          logger.warn("Removing invalid lock {}", getLockedBy());
          fileLock.release();
          revokeLock = true;
        }
      }
      catch (OverlappingFileLockException exc) {
        // lock is still valid
View Full Code Here

        }

        if (debugCompress) System.out.println("found uncompressed " + uncompressedFile + " for " + filename);
        return uncompressedFile.getPath();
      } finally {
        if (lock != null) lock.release();
        if (stream != null) stream.close();
      }
    }

    // ok gonna write it
View Full Code Here

          log.warn("failed to delete uncompressed file (IOException)" + uncompressedFile);
      }
      throw e;

    } finally {
      if (lock != null) lock.release();
      if (in != null) in.close();
      if (fout != null) fout.close();
    }

    return uncompressedFile.getPath();
View Full Code Here

                    if (lockType != SqlJetLockType.SHARED) {
            if (lockInfo.sharedLockCount <= 1) {
                          final FileLock sharedLock = locks.remove(SqlJetLockType.SHARED);
                          if(null != sharedLock) {
                            sharedLock.release();
                            lockInfo.sharedLock = null;
                          }
            }
                    }
View Full Code Here

                    locks.put(SqlJetLockType.SHARED, sharedLock);

                    /* Drop the temporary PENDING lock */
                    final FileLock pendingLock = locks.get(SqlJetLockType.PENDING);
                    if (null != pendingLock) {
                        pendingLock.release();
                        locks.remove(SqlJetLockType.PENDING);
                    }

                    if (null == sharedLock)
                        return false;
View Full Code Here

                    if (SqlJetLockType.SHARED == lockType) {

                        final FileLock exclusiveLock = locks.get(SqlJetLockType.EXCLUSIVE);
                        if (null != exclusiveLock) {
                            if (exclusiveLock.isValid())
                                exclusiveLock.release();
                            locks.remove(SqlJetLockType.EXCLUSIVE);
                        }

                        if (null == locks.get(SqlJetLockType.SHARED)) {
                            final FileLock sharedLock = fileLockManager.lock(SHARED_FIRST, SHARED_SIZE, true);
View Full Code Here

                    }

                    final FileLock reservedLock = locks.get(SqlJetLockType.RESERVED);
                    if (null != reservedLock) {
                        if (reservedLock.isValid())
                            reservedLock.release();
                        locks.remove(SqlJetLockType.RESERVED);
                    }

                    final FileLock pendingLock = locks.get(SqlJetLockType.PENDING);
                    if (null != pendingLock) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.