當前位置: 首頁>>代碼示例>>Java>>正文


Java FileLock.isValid方法代碼示例

本文整理匯總了Java中java.nio.channels.FileLock.isValid方法的典型用法代碼示例。如果您正苦於以下問題:Java FileLock.isValid方法的具體用法?Java FileLock.isValid怎麽用?Java FileLock.isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.nio.channels.FileLock的用法示例。


在下文中一共展示了FileLock.isValid方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: implCloseChannel

import java.nio.channels.FileLock; //導入方法依賴的package包/類
protected void implCloseChannel() throws IOException {
    // Release and invalidate any locks that we still hold
    if (fileLockTable != null) {
        for (FileLock fl: fileLockTable.removeAll()) {
            synchronized (fl) {
                if (fl.isValid()) {
                    nd.release(fd, fl.position(), fl.size());
                    ((FileLockImpl)fl).invalidate();
                }
            }
        }
    }

    // signal any threads blocked on this channel
    threads.signalAndWait();

    if (parent != null) {

        // Close the fd via the parent stream's close method.  The parent
        // will reinvoke our close method, which is defined in the
        // superclass AbstractInterruptibleChannel, but the isOpen logic in
        // that method will prevent this method from being reinvoked.
        //
        ((java.io.Closeable)parent).close();
    } else {
        nd.close(fd);
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:30,代碼來源:FileChannelImpl.java

示例2: closeLockFile

import java.nio.channels.FileLock; //導入方法依賴的package包/類
void closeLockFile() {
  FileLock myfl = this.fl;
  if (myfl != null) {
    try {
      FileChannel fc = myfl.channel();
      if (myfl.isValid()) {
        myfl.release();
      }
      fc.close();
    } catch (IOException ignore) {
    }
    this.fl = null;
  }
  File f = this.lockFile;
  if (f != null) {
    if (f.delete()) {
      if (logger.isDebugEnabled()) {
        logger.debug("Deleted lock file {}", f);
      }
    } else if (f.exists()) {
      if (logger.isDebugEnabled()) {
        logger.debug("Could not delete lock file {}", f);
      }
    }
  }
  if (logger.isDebugEnabled()) {
    logger.debug("Unlocked disk store {}", name);
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:30,代碼來源:DiskStoreImpl.java

示例3: implCloseChannel

import java.nio.channels.FileLock; //導入方法依賴的package包/類
protected void implCloseChannel() throws IOException {
    if (!fd.valid())
        return; // nothing to do

    // Release and invalidate any locks that we still hold
    if (fileLockTable != null) {
        for (FileLock fl: fileLockTable.removeAll()) {
            synchronized (fl) {
                if (fl.isValid()) {
                    nd.release(fd, fl.position(), fl.size());
                    ((FileLockImpl)fl).invalidate();
                }
            }
        }
    }

    // signal any threads blocked on this channel
    threads.signalAndWait();

    if (parent != null) {

        // Close the fd via the parent stream's close method.  The parent
        // will reinvoke our close method, which is defined in the
        // superclass AbstractInterruptibleChannel, but the isOpen logic in
        // that method will prevent this method from being reinvoked.
        //
        ((java.io.Closeable)parent).close();
    } else {
        nd.close(fd);
    }

}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:33,代碼來源:FileChannelImpl.java

示例4: isValid

import java.nio.channels.FileLock; //導入方法依賴的package包/類
private static boolean isValid(FileLock fileLock) {
    return fileLock != null && fileLock.isValid();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:ProcessLock.java


注:本文中的java.nio.channels.FileLock.isValid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。