public boolean contains(Object oid) { if (_cache == null) return false; try { return _cache.contains(oid); } catch (RuntimeException re) { throw translate(re); } }
public void addExpirationListener(ExpirationListener listen) { if (_cache == null) return; try { _cache.addExpirationListener(listen); } catch (RuntimeException re) { throw translate(re); } }
public void clear() { _dc.clear(); } }
/** * Returns the named cache. * If the given name is name or the name of the cache plugin then returns the main cache. * Otherwise, {@linkplain DataCache#getPartition(String, boolean) delegates} to the main cache * to obtain a partition. */ public DataCache getDataCache(String name, boolean create) { if (name == null || (_cache != null && name.equals(_cache.getName()))) return _cache; if (_cache != null) return _cache.getPartition(name, create); return null; }
} else if (!cache.contains(sm.getObjectId())) unloaded = addUnloaded(sm, null, unloaded); Map dataMap = cache.getAll(oidList); } else if (load != FORCE_LOAD_NONE || sm.getPCState() == PCState.HOLLOW) { data = cache.get(sm.getObjectId()); if (data != null) { cache.writeLock(); try { data = cache.get(sm.getObjectId()); if (data != null && compareVersion(sm, sm.getVersion(), data.getVersion()) == VERSION_EARLIER) data.store(sm, fields); if (isNew) cache.put(data); else cache.update(data); } finally { cache.writeUnlock();
data = cache.get(sm.getObjectId()); mods = getModifications(modMap, cache); cache.writeLock(); try { transformToVersionSafePCDatas(cache, mods.additions); transformToVersionSafePCDatas(cache, mods.newUpdates); transformToVersionSafePCDatas(cache, mods.existingUpdates); cache.commit(mods.additions, mods.newUpdates, mods.existingUpdates, mods.deletes); } finally { cache.writeUnlock();
public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
public void initialize(DataCacheManager manager) { if (_cache == null) return; try { _cache.initialize(manager); } catch (RuntimeException re) { throw translate(re); } }
public boolean exists(OpenJPAStateManager sm, Object edata) { DataCache cache = _mgr.selectCache(sm); CacheStatistics stats = (cache == null) ? null : cache.getStatistics(); if (cache != null && !isLocking(null) && cache.contains(sm.getObjectId())){ if (stats != null && stats.isEnabled()) { // delay this call ONLY if stats collection is enabled Class<?> cls = sm.getMetaData().getDescribedType(); ((CacheStatisticsSPI)stats).newGet(cls, false); } return true; } // If isLocking(null)==true && cache.contains(..) == true... probably shouldn't count? if (stats != null && stats.isEnabled()) { // delay this call ONLY if stats collection is enabled Class<?> cls = sm.getMetaData().getDescribedType(); ((CacheStatisticsSPI)stats).newGet(cls, false); } return super.exists(sm, edata); }
public String getCacheName() { if (_dc != null) return _dc.getName(); return null; }
public Map getAll(List keys) { if (_cache == null) return null; try { return _cache.getAll(keys); } catch (RuntimeException re) { throw translate(re); } } }
public BitSet containsAll(Collection<Object> oids) { if (_cache == null) return EMPTY_BITSET; try { return _cache.containsAll(oids); } catch (RuntimeException re) { throw translate(re); } }
public void close() { if (_cache == null) return; try { _cache.close(); } catch (RuntimeException re) { throw translate(re); } }
public void commit(Collection<DataCachePCData> additions, Collection<DataCachePCData> newUpdates, Collection<DataCachePCData> existingUpdates, Collection<Object> deletes) { if (_cache == null) return; try { _cache.commit(additions, newUpdates, existingUpdates, deletes); } catch (RuntimeException re) { throw translate(re); } }
} else if (!cache.contains(sm.getObjectId())) unloaded = addUnloaded(sm, null, unloaded); Map<Object,DataCachePCData> dataMap = cache.getAll(oidList); CacheStatistics stats = cache.getStatistics(); if (sm.getManagedInstance() == null) { if (data != null) { data = cache.get(sm.getObjectId()); if (data != null) { cache.writeLock(); try { data = cache.get(sm.getObjectId()); if (data != null && compareVersion(sm, sm.getVersion(), data.getVersion()) == VERSION_EARLIER) data.store(sm, fields); if (isNew) cache.put(data); else cache.update(data); CacheStatistics stats = cache.getStatistics(); if (stats.isEnabled()) { ((CacheStatisticsSPI)stats).newPut(data.getType()); cache.writeUnlock();
data.store(sm); mods.additions.add(new PCDataHolder(data, sm)); CacheStatistics stats = cache.getStatistics(); if (stats.isEnabled()) { ((CacheStatisticsSPI)stats).newPut(data.getType()); data = cache.get(sm.getObjectId()); mods = getModifications(modMap, cache); mods.existingUpdates.add(new PCDataHolder(data, sm)); CacheStatistics stats = cache.getStatistics(); if (stats.isEnabled()) { ((CacheStatisticsSPI)stats).newPut(data.getType()); cache.writeLock(); try { cache.commit( transformToVersionSafePCDatas(cache, mods.additions), transformToVersionSafePCDatas(cache, mods.newUpdates), mods.deletes); } finally { cache.writeUnlock();
public DataCachePCData get(Object oid) { if (_cache == null) return null; try { return _cache.get(oid); } catch (RuntimeException re) { throw translate(re); } }
@Override public void initialize(DataCacheManager mgr) { super.initialize(mgr); for(DataCache part : _partitions.values()){ part.initialize(mgr); } } /**
public boolean exists(OpenJPAStateManager sm, Object edata) { DataCache cache = _mgr.selectCache(sm); CacheStatistics stats = (cache == null) ? null : cache.getStatistics(); if (cache != null && !isLocking(null) && cache.contains(sm.getObjectId())){ if (stats != null && stats.isEnabled()) { // delay this call ONLY if stats collection is enabled Class<?> cls = sm.getMetaData().getDescribedType(); ((CacheStatisticsSPI)stats).newGet(cls, false); } return true; } // If isLocking(null)==true && cache.contains(..) == true... probably shouldn't count? if (stats != null && stats.isEnabled()) { // delay this call ONLY if stats collection is enabled Class<?> cls = sm.getMetaData().getDescribedType(); ((CacheStatisticsSPI)stats).newGet(cls, false); } return super.exists(sm, edata); }
public String getCacheName() { if (_dc != null) return _dc.getName(); return null; }