Package org.apache.lucene.store
Class VerifyingLockFactory
java.lang.Object
org.apache.lucene.store.LockFactory
org.apache.lucene.store.VerifyingLockFactory
A
LockFactory that wraps another LockFactory and 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 LockVerifyServer
on the host and port matching what you pass to the constructor.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionobtainLock(Directory dir, String lockName) Return a new obtained Lock instance identified by lockName.
-
Field Details
-
MSG_LOCK_RELEASED
public static final int MSG_LOCK_RELEASED- See Also:
-
MSG_LOCK_ACQUIRED
public static final int MSG_LOCK_ACQUIRED- See Also:
-
-
Constructor Details
-
VerifyingLockFactory
- Parameters:
lf- the LockFactory that we are testingin- the socket's input toLockVerifyServerout- the socket's output toLockVerifyServer- Throws:
IOException
-
-
Method Details
-
obtainLock
Description copied from class:LockFactoryReturn a new obtained Lock instance identified by lockName.- Specified by:
obtainLockin classLockFactory- Parameters:
lockName- name of the lock to be created.- Throws:
IOException- if any i/o error occurs attempting to gain the lock
-