/** * {@inheritDoc} */ public Object get(Object key, long txTimestamp) throws CacheException { return cache.get(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); } }
/** * Gets an object from the cache. * * @param key an Object value * @return the Object, or null if not found * @throws CacheException */ public final Object read(Object key) throws CacheException { return get(key); }
/** * {@inheritDoc} */ public Object get(Object key, long timestamp) throws CacheException { return cache.get(key); }
/** * {@inheritDoc} */ public boolean put(Object key, Object value, long timestamp, Object version, Comparator versionComparator, boolean minimalPut) throws CacheException { if (minimalPut && cache.get(key) != null) { return false; } else { cache.put(key, value); return true; } }
/** * {@inheritDoc} */ public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut) throws CacheException { if (minimalPut && cache.get(key) != null) { return false; } else { cache.put(key, value); return true; } }
/** * {@inheritDoc} */ public Object get(Object key, long txTimestamp) throws CacheException { readLockIfCoarse(key); try { Lockable item = (Lockable) cache.get(key); boolean readable = item != null && item.isReadable(txTimestamp); if (readable) { return item.getValue(); } else { return null; } } finally { readUnlockIfCoarse(key); } }
/** * Soft-unlocks the associated mapping. */ public void release(Object key, SoftLock lock) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); if ((item != null) && item.isUnlockable(lock)) { decrementLock(key, (Lock) item); } else { handleLockExpiry(key); } } finally { writeUnlock(key); } }
/** * {@inheritDoc} */ public boolean afterInsert(Object key, Object value, Object version) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); if (item == null) { cache.update(key, new Item(value, version, cache.nextTimestamp())); return true; } else { return false; } } finally { writeUnlock(key); } }
/** * {@inheritDoc} */ public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); boolean writeable = item == null || item.isWriteable(txTimestamp, version, versionComparator); if (writeable) { cache.put(key, new Item(value, version, cache.nextTimestamp())); return true; } else { return false; } } finally { writeUnlock(key); } }
/** * {@inheritDoc} */ public Object get(Object key, long txTimestamp) throws CacheException { return cache.get(key); }
/** * {@inheritDoc} */ public Object get(Object key, long timestamp) throws CacheException { return cache.get(key); }
/** * {@inheritDoc} */ public Object get(Object key, long txTimestamp) throws CacheException { return cache.get(key); }
/** * {@inheritDoc} */ public Object get(Object key, long timestamp) throws CacheException { return cache.get(key); }
/** * Gets an object from the cache. * * @param key an Object value * @return the Object, or null if not found * @throws CacheException */ public final Object read(Object key) throws CacheException { return get(key); }
/** * Gets an object from the cache. * * @param key an Object value * @return the Object, or null if not found * @throws CacheException */ public final Object read(Object key) throws CacheException { return get(key); }
/** * {@inheritDoc} */ public boolean afterUpdate(Object key, Object value, Object version, SoftLock softlock) throws CacheException { writeLock(key); try { Lockable item = (Lockable) cache.get(key); if (item != null && item.isUnlockable(softlock)) { Lock lock = (Lock) item; if (lock.wasLockedConcurrently()) { decrementLock(key, lock); return false; } else { cache.update(key, new Item(value, version, cache.nextTimestamp())); return true; } } else { handleLockExpiry(key); return false; } } finally { writeUnlock(key); } }
/** * {@inheritDoc} */ public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut) throws CacheException { if (minimalPut && cache.get(key) != null) { return false; } else { cache.put(key, value); return true; } }
/** * {@inheritDoc} */ public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut) throws CacheException { if (minimalPut && cache.get(key) != null) { return false; } else { cache.put(key, value); return true; } }
/** * {@inheritDoc} */ public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut) throws CacheException { if (minimalPut && cache.get(key) != null) { return false; } else { cache.put(key, value); return true; } }