• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FileAlreadyLockedException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openide.filesystems.FileAlreadyLockedException的典型用法代码示例。如果您正苦于以下问题:Java FileAlreadyLockedException类的具体用法?Java FileAlreadyLockedException怎么用?Java FileAlreadyLockedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FileAlreadyLockedException类属于org.openide.filesystems包,在下文中一共展示了FileAlreadyLockedException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: registerLock

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private static LockForFile registerLock(LockForFile result) throws IOException, FileAlreadyLockedException {
    File file = result.getFile();
    Namesakes namesakes = new Namesakes();
    Namesakes oldNamesakes = name2Namesakes.putIfAbsent(file.getName(), namesakes);
    if (oldNamesakes != null) { 
        namesakes = oldNamesakes;
    }
    if (namesakes.putInstance(file, result) == null) {
        FileAlreadyLockedException alreadyLockedException = new FileAlreadyLockedException(file.getAbsolutePath());
        LockForFile previousLock = namesakes.getInstance(file);
        // #151576 - check for null although it should not happen
        if (previousLock != null) {
            alreadyLockedException.initCause(previousLock.lockedBy);
        }
        throw alreadyLockedException;
    }
    result.valid = true;
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:LockForFile.java


示例2: revertButtonActionPerformed

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private void revertButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_revertButtonActionPerformed
    final Node [] nodes = manager.getSelectedNodes ();
    if (nodes != null && confirmRevert(nodes)) {
        // Are you sure DLG
        rp.post(new Runnable() {
            @Override
            public void run() {
                for (Node node : nodes) {
                    FileObject fo = node.getLookup().lookup(FileObject.class);
                    if (fo != null) {
                        try {
                            fo.revert();
                        } catch (FileAlreadyLockedException falex) {
                            notifyFileLocked(fo);
                            revertButton.setEnabled(true);
                        } catch (IOException ex) {
                            Logger.getLogger(TemplatesPanel.class.getName()).log(Level.WARNING, null, ex);
                        }
                    }
                }
            }
        });
        revertButton.setEnabled(false);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:TemplatesPanel.java


示例3: test68015

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
public void test68015 () throws Exception {
    DES edSupport = support();
    edSupport.open();
    
    waitEQ();
    
    edSupport.desEnv().markModified();
    
    assertTrue(edSupport.messageName().indexOf('*') != -1);
    assertTrue(edSupport.messageHtmlName().indexOf('*') != -1);

    try {
        assertLockFree(fileObject);
        fail("File shall be locked already");
    } catch (FileAlreadyLockedException ex) {
        // OK
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DataEditorSupportTest.java


示例4: lock

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
@Override
public synchronized FileLock lock() throws IOException {
    if (lock != null) {
        FileLock f = (FileLock) lock.get();
        if (f != null) {
            //        System.out.println ("Already locked: " + this); // NOI18N
            throw new FileAlreadyLockedException();
        }
    }

    fs.lock(getPath());

    FileLock l = new AfLock();
    lock = new WeakReference(l);
    //    Thread.dumpStack ();
    //    System.out.println ("Locking file: " + this); // NOI18N

    return l;
}
 
开发者ID:daimor,项目名称:NBStudio,代码行数:20,代码来源:CacheFileObject.java


示例5: saveProperties

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
public void saveProperties() throws FileAlreadyLockedException, IOException {
    OutputStream out = null;
    FileLock lock = null;
    try {
        FileObject pFile = file.getPrimaryFile();
        FileObject myFile = FileUtil.findBrother(pFile, extension);
        if (myFile == null) {
            myFile = FileUtil.createData(pFile.getParent(), pFile.getName() + "." + extension);
        }
        lock = myFile.lock();
        out = myFile.getOutputStream(lock);
        store(out, "");
    } finally {
        if (out != null) {
            out.close();
        }
        if (lock != null) {
            lock.releaseLock();
        }
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:22,代码来源:AssetData.java


示例6: lock

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
public FileLock lock() throws IOException {
    synchronized (this) {
        FileLock current = getLock();
        if (current != null) {
            throw new FileAlreadyLockedException("File is already locked by [" + current + "]."); // NO18N
        }
        FileLock l = new FileLock();
        lockReference = new WeakReference(l);
        return l;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:XmlMultiViewDataObject.java


示例7: getOutputStream

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private static OutputStream getOutputStream(FileObject fo) throws FileAlreadyLockedException, IOException, InterruptedException {
    int retry = 0;
    while (true) {
        try {
            return fo.getOutputStream();
        } catch (IOException ioe) {
            retry++;
            if (retry > 7) {
                throw ioe;
            }
            Thread.sleep(retry * 30);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:Utils.java


示例8: getOutputStream

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
private static OutputStream getOutputStream(FileObject fo) throws FileAlreadyLockedException, IOException, InterruptedException {
    int retry = 0;
    while (true) {
        try {
            return fo.getOutputStream();                
        } catch (IOException ioe) {            
            retry++;
            if (retry > 7) {
                throw ioe;
            }
            Thread.sleep(retry * 30);
        } 
    }                    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:RevertDeletedAction.java


示例9: writeMindMap

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
protected static void writeMindMap(final File file, final MindMap map) throws IOException {
  final FileObject fileObject = FileUtil.toFileObject(file);
  FileLock lock = null;
  while (true) {
    try {
      lock = fileObject.lock();
      break;
    }
    catch (FileAlreadyLockedException ex) {
      delay(500L);
    }
  }
  try {
    final OutputStream out = fileObject.getOutputStream(lock);
    try {
      IOUtils.write(map.packToString(), out, "UTF-8"); //NOI18N
    }
    finally {
      IOUtils.closeQuietly(out);
    }
  }
  finally {
    if (lock != null) {
      lock.releaseLock();
    }
  }
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:28,代码来源:AbstractElement.java


示例10: takeLock

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
protected FileLock takeLock() throws IOException {
    FileLock fileLock = null;
    try {
        fileLock = super.getDataObject().getPrimaryFile().lock();
    } catch (FileAlreadyLockedException exception) {
        
    }
    return fileLock;
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:10,代码来源:TGDEditorSupport.java


示例11: saveProperties

import org.openide.filesystems.FileAlreadyLockedException; //导入依赖的package包/类
@Deprecated
public void saveProperties() throws FileAlreadyLockedException, IOException {
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:4,代码来源:AssetData.java



注:本文中的org.openide.filesystems.FileAlreadyLockedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NfsTime类代码示例发布时间:2022-05-22
下一篇:
Java CompressionMode类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap