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


                : new XMPTree(xmp);
                //System.out.println(new String(xmpEditor.toUTF8Bytes(null)));
                xmpEditor.setXMPProperties(XMPTree.NS_EXIF, asXMPExifProperties(wpt));
                tmpFile = xmpjpg.setXMP(ByteBuffer.wrap(xmpEditor.toXPacket(previousSize)));
            } finally {
                lock.release();
                input.close();
            }
            result = (tmpFile == null) || (jpeg.delete() && tmpFile.renameTo(jpeg));
            if(!result){
                throw new IOException("Cannot overwrite " + jpeg + " with temporary file " + tmpFile);
View Full Code Here

        }
        try{
            result = new XMPJpeg(input, false).getXMP();
        } finally {
            //Do not release lock AFTER closing
            lock.release();
            input.close();
        }
        return result;
    }
View Full Code Here

      }
    } finally {
      if (lock != null) {
        try {
          lock.release();
        }catch (Throwable t) {
              if(LOGGER.isLoggable(Level.INFO))
                LOGGER.log(Level.INFO,t.getLocalizedMessage(),t);
        }
      }
View Full Code Here

      {
        try
        {
          if(fileLock != null)
          {
            fileLock.release();
          }
          fileLockStream.close();
        }
        catch(IOException ex)
        {
View Full Code Here

        try {
            FileLock lock = raf.getChannel().lock();
            try {
                callback.run(raf);
            } finally {
                lock.release();
            }
        } finally {
            raf.close();
        }
    }
View Full Code Here

        try {
            FileLock lock = raf.getChannel().lock();
            try {
                return callback.call(raf);
            } finally {
                lock.release();
            }
        } finally {
            raf.close();
        }
    }
View Full Code Here

        try {
            FileLock lock = raf.getChannel().lock();
            try {
                callback.run(raf);
            } finally {
                lock.release();
            }
        } finally {
            raf.close();
        }
    }
View Full Code Here

            FileLock lock = raf.getChannel().lock();
           
            try {
                return callback.call(raf);
            } finally {
                lock.release();
            }
        } finally {
            raf.close();
        }
    }
View Full Code Here

        c.position(4000);
        c.write(ByteBuffer.wrap(new byte[1]));
        FileLock lock = c.tryLock();
        c.truncate(0);
        if (lock != null) {
            lock.release();
        }
        c.close();
    }

    public void testUserHome() throws IOException {
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.