@Override public void updateMaxCounterForClass(DomainClassInfo domainClassInfo, int newCounterValue) { Transaction current = FenixFramework.getTransaction(); Set<DomainClassInfo> infos = current.getFromContext(KEY_INSTANTIATED_CLASSES); if (infos == null) { infos = new HashSet<DomainClassInfo>(); current.putInContext(KEY_INSTANTIATED_CLASSES, infos); } if (infos.add(domainClassInfo)) { logger.debug("Will update counter for instances of {} upon commit.", domainClassInfo.domainClassName); } }
@Override public void updateMaxCounterForClass(DomainClassInfo domainClassInfo, final int newCounterValue) { Transaction current = FenixFramework.getTransaction(); Set<DomainClassInfo> infos = current.getFromContext(KEY_INSTANTIATED_CLASSES); if (infos == null) { infos = new HashSet<DomainClassInfo>(); current.putInContext(KEY_INSTANTIATED_CLASSES, infos); } if (infos.add(domainClassInfo)) { logger.debug("Will update counter for instances of {} upon commit.", domainClassInfo.domainClassName); } }
@Override public void beforeRemove(Relation<DomainObject, DomainObject> rel, DomainObject o1, DomainObject o2) { if (o1 == null || o2 == null) return; // Ignore relations with null ((TxStats) FenixFramework.getTransaction().getTxIntrospector()).addModifiedRelation(new RelationChangelog(rel .getName(), o1, o2, true)); }
@Override public void beforeAdd(Relation<DomainObject, DomainObject> rel, DomainObject o1, DomainObject o2) { if (o1 == null || o2 == null) return; // Ignore relations with null ((TxStats) FenixFramework.getTransaction().getTxIntrospector()).addModifiedRelation(new RelationChangelog(rel .getName(), o1, o2, false)); }
private void updatePersistentInstanceCounters() { Transaction current = FenixFramework.getTransaction(); Set<DomainClassInfo> infos = current.getFromContext(KEY_INSTANTIATED_CLASSES); if (infos != null) { for (DomainClassInfo info : infos) { String key = makeKeyForMaxCounter(info); Integer max = (Integer) dataGrid.get(key); int newCounterValue = info.getLastKey(); if (max == null || max < newCounterValue) { dataGrid.put(key, newCounterValue); logger.debug("Update persistent counter for class {}: {}", info.domainClassName, newCounterValue); } } } }
private void updatePersistentInstanceCounters() { Transaction current = FenixFramework.getTransaction(); Set<DomainClassInfo> infos = current.getFromContext(KEY_INSTANTIATED_CLASSES); if (infos != null) { for (DomainClassInfo info : infos) { String key = makeKeyForMaxCounter(info); Integer max = (Integer) getSystemCache().get(key); int newCounterValue = info.getLastKey(); if (max == null || max < newCounterValue) { getSystemCache().put(key, newCounterValue); logger.debug("Update persistent counter for class {}: {}", info.domainClassName, newCounterValue); } } } }