public class BlocksLocker extends Object
Constructor and Description |
---|
BlocksLocker(WorkerStorage workerStorage,
int userId) |
Modifier and Type | Method and Description |
---|---|
int |
getLockId()
Get new lock id
|
StorageDir |
lock(long blockId,
int blockLockId)
Lock a block with specified lock id.
|
StorageDir |
locked(long blockId)
Get StorageDir in which the block is locked
|
boolean |
unlock(long blockId,
int lockId)
Unlock a block with a lock id.
|
public BlocksLocker(WorkerStorage workerStorage, int userId)
public StorageDir lock(long blockId, int blockLockId)
blockId
- The id of the block.blockLockId
- The lock id of the blockpublic int getLockId()
public StorageDir locked(long blockId)
blockId
- The id of the blockpublic boolean unlock(long blockId, int lockId)
blockId
- The id of the block.lockId
- The lock id of the lock.Copyright © 2015. All Rights Reserved.