Class OpenFileLock.FileLockHandle
java.lang.Object
cloud.opencode.base.io.lock.OpenFileLock.FileLockHandle
- All Implemented Interfaces:
Closeable, AutoCloseable
- Enclosing class:
OpenFileLock
File Lock Handle
文件锁句柄
AutoCloseable handle for file locks. Use with try-with-resources.
文件锁的 AutoCloseable 句柄,配合 try-with-resources 使用。
- Since:
- JDK 25, opencode-base-io V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Get the underlying FileChannel 获取底层 FileChannelgetLock()Get the underlying FileLock 获取底层 FileLockgetPath()Get the locked file path 获取锁定的文件路径booleanisShared()Check if this is a shared lock 检查是否为共享锁booleanisValid()Check if lock is still valid 检查锁是否仍然有效toString()
-
Method Details
-
getPath
-
isValid
public boolean isValid()Check if lock is still valid 检查锁是否仍然有效- Returns:
- true if valid | 如果有效返回 true
-
getChannel
Get the underlying FileChannel 获取底层 FileChannel- Returns:
- file channel | 文件通道
-
getLock
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
toString
-