[Mulgara-svn] r1172 - trunk/src/jar/resolver/java/org/mulgara/resolver

pag at mulgara.org pag at mulgara.org
Sat Aug 23 06:00:33 UTC 2008


Author: pag
Date: 2008-08-22 23:00:32 -0700 (Fri, 22 Aug 2008)
New Revision: 1172

Modified:
   trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java
Log:
Updated to allow for null node pools, in which case the string pool is expected to be its own node pool

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java	2008-08-23 02:04:55 UTC (rev 1171)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/StringPoolSessionFactory.java	2008-08-23 06:00:32 UTC (rev 1172)
@@ -113,13 +113,13 @@
     this.hostnameAliases = hostnameAliases;
 
     // Create the persistent node pool
+    XANodePool nodePool = null;
     try {
       NodePoolFactory factory =
         (NodePoolFactory) newFactory(persistentNodePoolFactoryInitializer,
                                      persistentNodePoolFactoryClassName,
                                      NodePoolFactory.class);
-      persistentNodePool = (XANodePool)factory.newNodePool();
-      assert persistentNodePool != null;
+      nodePool = (XANodePool)factory.newNodePool();
     } catch (ClassCastException ec) {
       logger.error("Error obtaining XANodePool. (" + persistentNodePoolFactoryClassName + ")");
       throw new InitializerException("Persistent Node-pool non-transactional", ec);
@@ -138,6 +138,14 @@
       throw new InitializerException("Persistent String-pool non-transactional", ec);
     }
 
+    if (nodePool == null) {
+      if (!(persistentStringPool instanceof XANodePool)) {
+        throw new IllegalArgumentException("Can only use a node pool from " + persistentNodePoolFactoryClassName + " if string pool from " + persistentStringPoolFactoryClassName + " is also a node pool.");
+      }
+      nodePool = (XANodePool)persistentStringPool;
+    }
+    // now we know the node pool, we can set the final field
+    persistentNodePool = nodePool;
     persistentNodePool.addNewNodeListener(persistentStringPool);
 
     // Create the factory used to create node pools for temporary resources




More information about the Mulgara-svn mailing list