Attempts to grab the lock, blocking if already held by another thread or process.
()
| 76 | * Attempts to grab the lock, blocking if already held by another thread or process. |
| 77 | */ |
| 78 | public void lock() { |
| 79 | mThreadLock.lock(); |
| 80 | if (mFileLevelLock) { |
| 81 | try { |
| 82 | mLockChannel = new FileOutputStream(mCopyLockFile).getChannel(); |
| 83 | mLockChannel.lock(); |
| 84 | } catch (IOException e) { |
| 85 | throw new IllegalStateException("Unable to grab copy lock.", e); |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Releases the lock. |
no test coverage detected