private void handleLockExpiry(Object key) { long ts = cache.nextTimestamp() + cache.getTimeout(); // create new lock that times out immediately Lock lock = new Lock(ts, uuid, nextLockId.getAndIncrement(), null); lock.unlock(ts); cache.update(key, lock); }
/** * Soft-locks the associated mapping prior to updating/inserting a new value. */ public SoftLock lock(Object key, Object version) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); long timeout = cache.nextTimestamp() + cache.getTimeout(); final Lock lock = (item == null) ? new Lock(timeout, uuid, nextLockId(), version) : item.lock(timeout, uuid, nextLockId()); cache.update(key, lock); return lock; } finally { writeUnlock(key); } }
private void handleLockExpiry(Object key) { long ts = cache.nextTimestamp() + cache.getTimeout(); // create new lock that times out immediately Lock lock = new Lock(ts, uuid, nextLockId.getAndIncrement(), null); lock.unlock(ts); cache.update(key, lock); }
private void handleLockExpiry(Object key) { long ts = cache.nextTimestamp() + cache.getTimeout(); // create new lock that times out immediately Lock lock = new Lock(ts, uuid, nextLockId.getAndIncrement(), null); lock.unlock(ts); cache.update(key, lock); }
private void handleLockExpiry(Object key) { long ts = cache.nextTimestamp() + cache.getTimeout(); // create new lock that times out immediately Lock lock = new Lock(ts, uuid, nextLockId.getAndIncrement(), null); lock.unlock(ts); cache.update(key, lock); }
/** * Soft-locks the associated mapping prior to updating/inserting a new value. */ public SoftLock lock(Object key, Object version) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); long timeout = cache.nextTimestamp() + cache.getTimeout(); final Lock lock = (item == null) ? new Lock(timeout, uuid, nextLockId(), version) : item.lock(timeout, uuid, nextLockId()); cache.update(key, lock); return lock; } finally { writeUnlock(key); } }
/** * Soft-locks the associated mapping prior to updating/inserting a new value. */ public SoftLock lock(Object key, Object version) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); long timeout = cache.nextTimestamp() + cache.getTimeout(); final Lock lock = (item == null) ? new Lock(timeout, uuid, nextLockId(), version) : item.lock(timeout, uuid, nextLockId()); cache.update(key, lock); return lock; } finally { writeUnlock(key); } }
/** * Soft-locks the associated mapping prior to updating/inserting a new value. */ public SoftLock lock(Object key, Object version) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); long timeout = cache.nextTimestamp() + cache.getTimeout(); final Lock lock = (item == null) ? new Lock(timeout, uuid, nextLockId(), version) : item.lock(timeout, uuid, nextLockId()); cache.update(key, lock); return lock; } finally { writeUnlock(key); } }