4
A
回答
4
如果你问有关文件锁,从Example Depot下面的例子演示了如何使用它:
try {
// Get a file channel for the file
File file = new File("filename");
FileChannel channel = new RandomAccessFile(file, "rw").getChannel();
// Use the file channel to create a lock on the file.
// This method blocks until it can retrieve the lock.
FileLock lock = channel.lock();
// Try acquiring the lock without blocking. This method returns
// null or throws an exception if the file is already locked.
try {
lock = channel.tryLock();
} catch (OverlappingFileLockException e) {
// File is already locked in this thread or virtual machine
}
// Release the lock
lock.release();
// Close the file
channel.close();
} catch (Exception e) {
}
相关问题
- 1. Java文档状态模式?
- 2. java中的状态栏?
- 3. Java中的状态模式
- 4. java中的状态流
- 5. Java中的状态栏
- 6. 静态文件状态'404
- 7. Puma。状态文件
- 8. 将gcc编译状态保存为Java的文本文件
- 9. “无状态”组件中的上下文?
- 10. 配置文件中的WinForm状态
- 11. OpenCobol文件状态35
- 12. 配置logrotate状态文件
- 13. P4 - 清除文件状态
- 14. Android按钮状态文件
- 15. SharpSvn - 锁定文件状态
- 16. PHP文件上传状态
- 17. Java Quartz Scheduler状态
- 18. Java更改状态
- 19. Java存储状态
- 20. java bean中的PropertyEditor是有状态的?
- 21. 如何将git文件状态添加到vim的状态行?
- 22. 在状态文件中使用参数
- 23. 检查回文(JAVA)(新秀状态)
- 24. 的Java JDBC连接状态
- 25. 如何根据IntelliJ中的文件状态过滤文件Idea
- 26. 监控Dropbox公用文件夹中文件的同步状态
- 27. Java中的链接状态通知
- 28. 在Java中检查网站的状态
- 29. Java中的螺纹状态机
- 30. 获取Java中MediaPlayer的当前状态
确定,但我怎么能知道哪个应用程序阻止它?捕捉异常,我可以告诉? – josemm1790
对不起,API没有说明什么:( –
好的谢谢,我会尝试。 – josemm1790