Author: toad
Date: 2008-07-11 23:38:19 +0000 (Fri, 11 Jul 2008)
New Revision: 21076

Modified:
   branches/db4o/freenet/src/freenet/node/Node.java
Log:
Turn on diagnostics, create some indexes.

Modified: branches/db4o/freenet/src/freenet/node/Node.java
===================================================================
--- branches/db4o/freenet/src/freenet/node/Node.java    2008-07-11 23:28:21 UTC 
(rev 21075)
+++ branches/db4o/freenet/src/freenet/node/Node.java    2008-07-11 23:38:19 UTC 
(rev 21076)
@@ -31,6 +31,9 @@
 import com.db4o.ObjectContainer;
 import com.db4o.ObjectServer;
 import com.db4o.config.QueryEvaluationMode;
+import com.db4o.diagnostic.Diagnostic;
+import com.db4o.diagnostic.DiagnosticBase;
+import com.db4o.diagnostic.DiagnosticListener;
 import com.sleepycat.je.DatabaseException;
 import com.sleepycat.je.Environment;
 import com.sleepycat.je.EnvironmentConfig;
@@ -729,6 +732,10 @@
                
Db4o.configure().objectClass(freenet.client.async.PersistentCooldownQueueItem.class).objectField("time").indexed(true);
                
Db4o.configure().objectClass(freenet.client.async.PendingKeyItem.class).objectField("key").indexed(true);
                
Db4o.configure().objectClass(freenet.client.async.PendingKeyItem.class).objectField("fullKeyAsBytes").indexed(true);
+               
Db4o.configure().objectClass(freenet.client.FECJob.class).objectField("priority").indexed(true);
+               
Db4o.configure().objectClass(freenet.client.FECJob.class).objectField("addedTime").indexed(true);
+               
Db4o.configure().objectClass(freenet.client.FECJob.class).objectField("queue").indexed(true);
+               
Db4o.configure().objectClass(freenet.client.async.PendingKeyItem.class).objectField("nodeDBHandle").indexed(true);
                /** Maybe we want a different query evaluation mode?
                 * At the moment, a big splitfile insert will result in one 
SingleBlockInserter
                 * for every key, which means one RegisterMe for each ... this 
results in a long pause
@@ -753,6 +760,17 @@
                 * has already been created. Yes, this has happened, yes, it 
sucks.
                 * Add our own hook to rollback and close... */
                Db4o.configure().automaticShutDown(false);
+               Db4o.configure().diagnostic().addListener(new 
DiagnosticListener() {
+
+                       public void onDiagnostic(Diagnostic arg0) {
+                               if(arg0 instanceof DiagnosticBase) {
+                                       DiagnosticBase d = (DiagnosticBase) 
arg0;
+                                       Logger.error(this, "Diagnostic: 
"+d.getClass()+" : "+d.problem()+" : "+d.solution()+" : "+d.reason());
+                               } else
+                                       Logger.error(this, "Diagnostic: 
"+arg0+" : "+arg0.getClass());
+                       }
+                       
+               });

                shutdownHook.addLateJob(new Thread() {



Reply via email to