java.lang.Object | |
↳ | com.netflix.astyanax.recipes.locks.ColumnPrefixDistributedRowLock<K> |
Takes a distributed row lock for a single row. The row lock is accomplished using
a sequence of read/write events to Cassandra without the need for something like
zookeeper.
Algorithm
1. Write a column with name
ColumnPrefixDistributedRowLock
Read, Modify, Write. The read, modify, write piggybacks on top of the lock calls.
ColumnPrefixDistributedRowLock
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_LOCK_PREFIX | ||||||||||
int | LOCK_TIMEOUT |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DEFAULT_OPERATION_TIMEOUT_UNITS |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Try to take the lock.
| |||||||||||
Take the lock and return the row data columns.
| |||||||||||
Time for failed locks.
| |||||||||||
When set to true the operation will fail if a stale lock is detected
| |||||||||||
Fill a mutation with the lock column.
| |||||||||||
Fill a mutation that will release the locks.
| |||||||||||
Return a mapping of existing lock columns and their expiration times@return
| |||||||||||
Release the lock by releasing this and any other stale lock columns
| |||||||||||
Release all locks.
| |||||||||||
Release all expired locks for this key.@return
| |||||||||||
Delete locks columns.
| |||||||||||
Release using the provided mutation.
| |||||||||||
Verify that the lock was acquired.
| |||||||||||
Specify the prefix that uniquely distinguishes the lock columns from data
column
| |||||||||||
Modify the consistency level being used.
| |||||||||||
If true the first read will also fetch all the columns in the row as
opposed to just the lock columns.
| |||||||||||
Override the autogenerated lock column.
| |||||||||||
This is the TTL on the lock column being written, as opposed to expireLockAfter which
is written as the lock column value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.netflix.astyanax.recipes.locks.DistributedRowLock
|
Try to take the lock. The caller must call .release() to properly clean up the lock columns from cassandra@return
Exception |
---|
Take the lock and return the row data columns. Use this, instead of acquire, when you want to implement a read-modify-write scenario and want to reduce the number of calls to Cassandra.@return
Exception |
---|
Time for failed locks. Under normal circumstances the lock column will be deleted. If not then this lock column will remain and the row will remain locked. The lock will expire after this timeout.
When set to true the operation will fail if a stale lock is detected
Fill a mutation with the lock column. This may be used when the mutation is executed externally but should be used with extreme caution to ensure the lock is properly released
Fill a mutation that will release the locks. This may be used from a separate recipe to release multiple locks.
Return a mapping of existing lock columns and their expiration times@return
Exception |
---|
Release the lock by releasing this and any other stale lock columns
Exception |
---|
Release all locks. Use this carefully as it could release a lock for a running operation.@return
Exception |
---|
Release all expired locks for this key.@return
Exception |
---|
Delete locks columns. Set force=true to remove locks that haven't expired yet. This operation first issues a read to cassandra and then deletes columns in the response.@return
force | - Force delete of non expired locks as well |
---|
Exception |
---|
Release using the provided mutation. Use this when you want to commit actual data when releasing the lock
Exception |
---|
Verify that the lock was acquired. This shouldn't be called unless it's part of a recipe built on top of ColumnPrefixDistributedRowLock.
Specify the prefix that uniquely distinguishes the lock columns from data column
Modify the consistency level being used. Consistency should always be a variant of quorum. The default is CL_QUORUM, which is OK for single region. For multi region the consistency level should be CL_LOCAL_QUORUM. CL_EACH_QUORUM can be used but will Incur substantial latency.
If true the first read will also fetch all the columns in the row as opposed to just the lock columns.
Override the autogenerated lock column.
This is the TTL on the lock column being written, as opposed to expireLockAfter which is written as the lock column value. Whereas the expireLockAfter can be used to identify a stale or abandoned lock the TTL will result in the stale or abandoned lock being eventually deleted by cassandra. Set the TTL to a number that is much greater tan the expireLockAfter time.