Author: toad
Date: 2008-07-12 01:02:54 +0000 (Sat, 12 Jul 2008)
New Revision: 21086

Modified:
   branches/db4o/freenet/src/freenet/client/async/PersistentCooldownQueue.java
Log:
possible optimisation

Modified: 
branches/db4o/freenet/src/freenet/client/async/PersistentCooldownQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/PersistentCooldownQueue.java 
2008-07-12 00:50:03 UTC (rev 21085)
+++ branches/db4o/freenet/src/freenet/client/async/PersistentCooldownQueue.java 
2008-07-12 01:02:54 UTC (rev 21086)
@@ -46,12 +46,22 @@
                Query query = container.query();
                query.constrain(PersistentCooldownQueueItem.class);
                query.descend("keyAsBytes").constrain(keyAsBytes);
-               query.descend("client").constrain(client);
-               query.descend("parent").constrain(this);
+               // The result from parent will be huge, and client may be huge 
too.
+               // Don't bother with a join, just check in the evaluation.
+//             query.descend("client").constrain(client);
+//             query.descend("parent").constrain(this);
                Evaluation eval = new Evaluation() {

                        public void evaluate(Candidate candidate) {
                                PersistentCooldownQueueItem item = 
(PersistentCooldownQueueItem) candidate.getObject();
+                               if(item.client != client) {
+                                       candidate.include(false);
+                                       return;
+                               }
+                               if(item.parent != PersistentCooldownQueue.this) 
{
+                                       candidate.include(false);
+                                       return;
+                               }
                                Key k = item.key;
                                candidate.objectContainer().activate(k, 5);
                                if(k.equals(key))


Reply via email to