import java.util.ArrayList;
import java.util.Iterator;
-import org.simantics.db.common.utils.Logger;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.impl.DebugPolicy;
import org.simantics.db.impl.graph.ReadGraphImpl;
import org.simantics.db.impl.procedure.InternalProcedure;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
abstract public class CacheEntryBase extends CacheEntry {
+ private static final Logger LOGGER = LoggerFactory.getLogger(CacheEntryBase.class);
+
// Default level is something that is not quite a prospect but still allows for ordering within CacheCollectionResult
public static final short UNDEFINED_LEVEL = 5;
statusOrException = EXCEPTED;
result = t;
} else {
- Logger.defaultLogError("Cache entry got excepted status after being discarded: " + getClass().getSimpleName(), t);
+ LOGGER.warn("Cache entry got excepted status after being discarded: " + getClass().getSimpleName(), t);
result = t;
}
}
final public boolean assertPending() {
boolean result = isPending();
if(!result) {
- System.err.println("Assertion failed, expected pending, got " + statusOrException);
+ LOGGER.warn("Assertion failed, expected pending, got " + statusOrException);
}
return result;
}
this.result = result;
}
+ @SuppressWarnings("unchecked")
@Override
final public <T> T getResult() {
assert(statusOrException != DISCARDED);
}
+
+ @Override
+ void pruneParentSet() {
+ // First parent is discarded => look for more parents
+ if(p2OrParents instanceof QueryIdentityHashSet) {
+
+ QueryIdentityHashSet set = (QueryIdentityHashSet)p2OrParents;
+ set.removeDiscardedReally();
+ if(set.isEmpty()) p2OrParents = null;
+
+ } else if(p2OrParents instanceof CacheEntry) {
+
+ CacheEntry entry = (CacheEntry)p2OrParents;
+ if(entry.isDiscarded()) {
+ // Second entry is also discarded => all empty
+ p2OrParents = null;
+ }
+
+ } else {
+
+ // Nothing left
+
+ }
+ }
+
@Override
final public void removeParent(CacheEntry entry) {