Package com.netflix.astyanax.recipes.locks

Examples of com.netflix.astyanax.recipes.locks.BusyLockException


                    // Stale lock so we can discard it
                    if (column.getLongValue() < curTimeMicros) {
                        queue.stats.incExpiredLockCount();
                        rowMutation.deleteColumn(lock);
                    } else if (lock.getState() == MessageQueueEntryState.Acquired) {
                        throw new BusyLockException("Not first lock");
                    } else {
                        lockCount++;
                        if (lockCount == 1 && lock.getTimestamp().equals(lockColumn.getTimestamp())) {
                            lockAcquired = true;
                        }
                    }
                    if (!lockAcquired) {
                        throw new BusyLockException("Not first lock");
                    }
                    // Write the acquired lock column
                    lockColumn = MessageQueueEntry.newLockEntry(lockColumn.getTimestamp(), MessageQueueEntryState.Acquired);
                    rowMutation.putColumn(lockColumn, curTimeMicros + queue.lockTimeout, queue.lockTtl);
                }
View Full Code Here


                    case Lock:
                        // TODO: Track number of locks read and make sure we don't exceed itemsToPop
                        // We have the lock
                        if (lockColumn != null && entry.getState() == MessageQueueEntryState.Acquired) {
                            if (!entry.getTimestamp().equals(lockColumn.getTimestamp())) {
                                throw new BusyLockException("Someone else snuck in");
                            }
                        }
                        break;
                    case Message:
                        {
View Full Code Here

                if (l.tryLock()) {
                    return new ReentrantShardLock(l, shardName);
                } else {
                    busyLockCounts.putIfAbsent(shardName, new AtomicInteger());
                    busyLockCounts.get(shardName).incrementAndGet();
                    throw new BusyLockException("Shard " + shardName + " is already locked" + ": busy lock count " + busyLockCounts.get(shardName));
                }
            } catch (Exception e) {
                throw new BusyLockException("Could not lock shard " + shardName, e);
            }
        }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.recipes.locks.BusyLockException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.