Package java.nio.channels

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


        firstLock.release();
        firstLock.channel().close();
      }
      if(secondLock != null) {
        secondLock.release();
        secondLock.channel().close();
      }
    }
    return false;
  }
View Full Code Here


          firstLock.release();
          firstLock.channel().close();
        }
        if(secondLock != null) {
          secondLock.release();
          secondLock.channel().close();
        }
      }
      return false;
    }
  }
View Full Code Here

    FileLock lock = locks.remove(dir.getAbsolutePath());
    if(lock == null) {
      return;
    }
    lock.release();
    lock.channel().close();
    lock = null;
  }
  static class BackgroundWorker implements Runnable {
    private static final Logger LOG = LoggerFactory
        .getLogger(BackgroundWorker.class);
View Full Code Here

   * @tests java.nio.channels.FileLock#FileLock(FileChannel, long, long,
   *        boolean)
   */
  public void test_Constructor_Ljava_nio_channels_FileChannelJJZ() {
    FileLock fileLock1 = new MockFileLock(null, 0, 0, false);
    assertNull(fileLock1.channel());

    try {
      new MockFileLock(readWriteChannel, -1, 0, false);
      fail("should throw IllegalArgumentException.");
    } catch (IllegalArgumentException ex) {
View Full Code Here

   * @tests java.nio.channels.FileLock#channel()
   */
  public void test_channel() {
    assertSame(readWriteChannel, mockLock.channel());
    FileLock lock = new MockFileLock(null, 0, 10, true);
    assertNull(lock.channel());
  }

  /**
   * @tests java.nio.channels.FileLock#position()
   */
 
View Full Code Here

    public void releaseExclusiveReadLock(GenericFileOperations<File> operations,
                                         GenericFile<File> file, Exchange exchange) throws Exception {
        FileLock lock = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLock", FileLock.class);
        String lockFileName = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLockName", String.class);
        Channel channel = lock.channel();
        try {
            lock.release();
        } finally {
            // must close channel first
            IOHelper.close(channel, "while acquiring exclusive read lock for file: " + lockFileName, LOG);
View Full Code Here

    public void releaseExclusiveReadLock(GenericFileOperations<File> operations,
                                         GenericFile<File> file, Exchange exchange) throws Exception {
        FileLock lock = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLock", FileLock.class);
        String lockFileName = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLockName", String.class);
        Channel channel = lock.channel();
        try {
            lock.release();
        } finally {
            // must close channel first
            ObjectHelper.close(channel, "while acquiring exclusive read lock for file: " + lockFileName, LOG);
View Full Code Here

    public void releaseExclusiveReadLock(GenericFileOperations<File> operations,
                                         GenericFile<File> file, Exchange exchange) throws Exception {
        FileLock lock = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLock", FileLock.class);
        String lockFileName = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLockName", String.class);
        Channel channel = lock.channel();
        try {
            lock.release();
        } finally {
            // must close channel first
            ObjectHelper.close(channel, "while acquiring exclusive read lock for file: " + lockFileName, LOG);
View Full Code Here

        firstLock.release();
        firstLock.channel().close();
      }
      if(secondLock != null) {
        secondLock.release();
        secondLock.channel().close();
      }
    }
    return false;
  }
View Full Code Here

    public void releaseExclusiveReadLock(GenericFileOperations<File> operations,
                                         GenericFile<File> file, Exchange exchange) throws Exception {
        FileLock lock = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLock", FileLock.class);
        String lockFileName = ExchangeHelper.getMandatoryProperty(exchange, "CamelFileLockName", String.class);
        Channel channel = lock.channel();
        try {
            lock.release();
        } finally {
            // must close channel first
            ObjectHelper.close(channel, "while acquiring exclusive read lock for file: " + lockFileName, LOG);
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.