use of org.drools.core.common.InternalWorkingMemoryEntryPoint in project drools by kiegroup.
the class DefaultKnowledgeHelper method update.
public void update(final FactHandle handle, BitMask mask, Class<?> modifiedClass) {
InternalFactHandle h = (InternalFactHandle) handle;
if (h.getDataSource() != null) {
// This handle has been insert from a datasource, so update it
h.getDataSource().update(h, ((InternalFactHandle) handle).getObject(), mask, modifiedClass, this.activation);
return;
}
((InternalWorkingMemoryEntryPoint) h.getEntryPoint()).update(h, ((InternalFactHandle) handle).getObject(), mask, modifiedClass, this.activation);
if (h.isTraitOrTraitable()) {
workingMemory.updateTraits(h, mask, modifiedClass, this.activation);
}
}
use of org.drools.core.common.InternalWorkingMemoryEntryPoint in project drools by kiegroup.
the class KieBaseUpdater method clearInstancesOfModifiedClass.
protected void clearInstancesOfModifiedClass(Class<?> cls) {
// remove all ObjectTypeNodes for the modified classes
ClassObjectType objectType = new ClassObjectType(cls);
for (EntryPointNode epn : ctx.kBase.getRete().getEntryPointNodes().values()) {
epn.removeObjectType(objectType);
}
// remove all instance of the old class from the object stores
for (InternalWorkingMemory wm : ctx.kBase.getWorkingMemories()) {
for (EntryPoint ep : wm.getEntryPoints()) {
InternalWorkingMemoryEntryPoint wmEp = (InternalWorkingMemoryEntryPoint) wm.getWorkingMemoryEntryPoint(ep.getEntryPointId());
ClassAwareObjectStore store = ((ClassAwareObjectStore) wmEp.getObjectStore());
if (store.clearClassStore(cls)) {
log.warn("Class " + cls.getName() + " has been modified and therfore its old instances will no longer match");
}
}
}
}
Aggregations