ch.cyberduck.core.Local.lock()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中ch.cyberduck.core.Local.lock()方法的一些代码示例,展示了Local.lock()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local.lock()方法的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
方法名:lock

Local.lock介绍

暂无

代码示例

代码示例来源:origin: iterate-ch/cyberduck

/**
 * @param source      Connection to source server of transfer. May be null.
 * @param destination Connection to target server of transfer
 * @param files       Files pending transfer
 * @param callback    Prompt
 */
public void pre(final Session<?> source, final Session<?> destination, final Map<TransferItem, TransferStatus> files, final ConnectionCallback callback) throws BackgroundException {
  for(TransferItem item : roots) {
    switch(this.getType()) {
      case download:
        final Local directory = item.local.getParent();
        locks.put(directory, directory.lock(true));
        break;
      case upload:
        locks.put(item.local, item.local.lock(true));
        break;
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@Override
public void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException {
  final Path home = new LocalHomeFinderFeature(this).find();
  try {
    lock = LocalFactory.get(this.toPath(home).toString()).lock(true);
  }
  catch(LocalAccessDeniedException e) {
    log.debug(String.format("Ignore failure obtaining lock for %s", home));
  }
}

相关文章