当前位置: 首页>>代码示例>>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;未经允许,请勿转载。