Locks are identified {@link KeyColumn} instances.{@code KeyColumn#equals(Object)} should be used to determine whether two{@code KeyColumn} instances refer to the same or different locks.
Threads taking locks are identified by {@link StoreTransaction} instances.Either {@code equals(...)} or reference equality (the {@code ==} operator)can be used to compare these instances.
This interface follows a three-step locking model that supports both nonblocking and blocking locking primitives. Not all Titan {@code StoreTransaction}s will need locks and use this interface. For those {@code StoreTransaction}s that do take one or more locks, Titan will call the methods on this interface in the following order. {@code tx} refers to thesame {@code StoreTransaction} instance in each step.
The first step, {@code writeLocks}, attempts to take a lock. This may, but need not necessarily, indicate whether the attempt succeeded or failed. The second step, {@code checkLocks}, returns if all previous {@code writeLocks}succeeded or throws an exception if one or more failed. The final step, {@code deleteLocks}, releases all locks and associated resources held by the {@code tx}.
All implementations of this interface must be safe for concurrent use by different threads. However, implementations may assume that, for any given {@code StoreTransaction tx}, all calls to this interface's methods with argument {@code tx} will either come from a single thread or multiple threadsusing external synchronization to provide the same effect.
|
|