X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FQueryCollectorImpl.java;h=0b6f6ef834411316255ac12e80f56faa3d3bdd93;hb=c4d9561b1b35a0e8e594158fbb01a9c632997808;hp=965f1e39f41fb1dc4d99000d533c03dde6c21da3;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java index 965f1e39f..0b6f6ef83 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java @@ -42,6 +42,10 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { @Override public void collect(int youngTarget, int allowedTimeInMs) { + // Flush listener registrations to prevent the collector from trashing + // listeners that are still queued up waiting to be registered. + queryProcessor.listening.sync(); + long start = System.nanoTime(); // Refresh current size @@ -160,7 +164,7 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { } } - if(queryProcessor.hasListenerAfterDisposing(entry)) { + if(queryProcessor.listening.hasListenerAfterDisposing(entry)) { if((status & CacheEntry.HAS_BEEN_BOUND) == 0) { queryProcessor.boundQueries++; entry.setGCStatusFlag(CacheEntry.HAS_BEEN_BOUND, true); @@ -176,7 +180,7 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { } private boolean tryCollect(CacheEntry entry) { - if (!queryProcessor.hasListenerAfterDisposing(entry)) + if (!queryProcessor.listening.hasListenerAfterDisposing(entry)) if(entry.shouldBeCollected()) { queryProcessor.removeQuery(entry); support.remove();