| Method from org.hibernate.cache.jbc2.timestamp.ClusteredConcurrentTimestampsRegionImpl Detail: |
protected Fqn createRegionFqn(String regionName,
String regionPrefix) {
return getTypeFirstRegionFqn(regionName, regionPrefix, TYPE);
}
|
public void destroy() throws CacheException {
getCacheInstance().removeCacheListener(this);
super.destroy();
localCache.clear();
}
|
public void evict(Object key) throws CacheException {
Option opt = getNonLockingDataVersionOption(true);
CacheHelper.removeNode(getCacheInstance(), getRegionFqn(), key, opt);
}
|
public void evictAll() throws CacheException {
Option opt = getNonLockingDataVersionOption(true);
CacheHelper.removeAll(getCacheInstance(), getRegionFqn(), opt);
}
|
public Object get(Object key) throws CacheException {
Entry entry = getLocalEntry(key);
Object timestamp = entry.getCurrent();
if (timestamp == null) {
// Double check the distributed cache
Object[] vals = (Object[]) suspendAndGet(key, null, false);
if (vals != null) {
storeDataFromJBC(key, vals);
timestamp = entry.getCurrent();
}
}
return timestamp;
}
|
public void invalidate(Object key,
Object value,
Object preInvalidateValue) throws CacheException {
Entry entry = getLocalEntry(key);
if (entry.invalidate(value, preInvalidateValue)) {
putInJBossCache(key, entry);
}
}
|
public void nodeModified(NodeModifiedEvent event) {
if (event.isOriginLocal() || event.isPre())
return;
Fqn fqn = event.getFqn();
Fqn regFqn = getRegionFqn();
if (fqn.size() == regFqn.size() + 1 && fqn.isChildOf(regFqn)) {
Object key = fqn.get(regFqn.size());
Object[] vals = (Object[]) event.getData().get(ITEM);
storeDataFromJBC(key, vals);
// TODO consider this hack instead of the simple entry.update above:
// if (!entry.update(vals[0], vals[1])) {
// // Hack! Use the fact that the Object[] stored in JBC is
// // mutable to correct our local JBC state in this callback
// Object[] correct = entry.getJBCUpdateValues();
// vals[0] = correct[0];
// vals[1] = correct[1];
// }
}
}
Monitors cache events and updates the local cache |
public void nodeRemoved(NodeRemovedEvent event) {
if (event.isOriginLocal() || event.isPre())
return;
Fqn fqn = event.getFqn();
Fqn regFqn = getRegionFqn();
if (fqn.isChildOrEquals(regFqn)) {
if (fqn.size() == regFqn.size()) {
localCache.clear();
}
else {
Object key = fqn.get(regFqn.size());
localCache.remove(key);
}
}
}
Monitors cache events and updates the local cache |
public void preInvalidate(Object key,
Object value) throws CacheException {
Entry entry = getLocalEntry(key);
if (entry.preInvalidate(value)) {
putInJBossCache(key, entry);
}
}
|
public void put(Object key,
Object value) throws CacheException {
throw new UnsupportedOperationException("Prototype only; Hibernate core must change the API before really using");
}
|