public class VerifyingLockFactory extends LockFactory
LockFactorythat wraps another
LockFactoryand verifies that each lock obtain/release is "correct" (never results in two processes holding the lock at the same time). It does this by contacting an external server (
LockVerifyServer) to assert that at most one process holds the lock at a time. To use this, you should also run
LockVerifyServeron the host & port matching what you pass to the constructor.
|Constructor and Description|
|Modifier and Type||Method and Description|
Attempt to clear (forcefully unlock and remove) the specified lock.
Return a new Lock instance identified by lockName.
public VerifyingLockFactory(byte id, LockFactory lf, String host, int port) throws IOException
id- should be a unique id across all clients
lf- the LockFactory that we are testing
host- host or IP where
port- the port
LockVerifyServeris listening on
public Lock makeLock(String lockName)
lockName- name of the lock to be created.
public void clearLock(String lockName) throws IOException
lockName- name of the lock to be cleared.