r9855 - helma/helma/trunk/src/helma/objectmodel/db

[email protected] Tue, 8 Sep 2009 15:51:39 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090908135139.CE42E3D0E3@mia>
Author: hannes
Date: 2009-09-08 15:51:39 +0200 (Tue, 08 Sep 2009)
New Revision: 9855

Modified:
   helma/helma/trunk/src/helma/objectmodel/db/Node.java
Log:
Make nmgr volatile, remove setter for wrapped node manager, and check for null nmgr in constructors.

Details at http://dev.helma.org/trac/helma/changeset/9855

Modified: helma/helma/trunk/src/helma/objectmodel/db/Node.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-09-07 13:30:45 UTC (rev 9854)
+++ helma/helma/trunk/src/helma/objectmodel/db/Node.java	2009-09-08 13:51:39 UTC (rev 9855)
@@ -60,7 +60,7 @@
     private transient String prototype;
     private transient NodeHandle handle;
     private transient INode cacheNode;
-    transient WrappedNodeManager nmgr;
+    transient volatile WrappedNodeManager nmgr;
     transient DbMapping dbmap;
     transient Key primaryKey = null;
     transient String subnodeRelation = null;
@@ -113,6 +113,9 @@
      * Constructor used for virtual nodes.
      */
     public Node(Node home, String propname, WrappedNodeManager nmgr, String prototype) {
+        if (nmgr == null) {
+            throw new NullPointerException("nmgr");
+        }
         this.nmgr = nmgr;
         setParent(home);
         // generate a key for the virtual node that can't be mistaken for a Database Key
@@ -134,6 +137,9 @@
      * Creates a new Node with the given name. This is used for ordinary transient nodes.
      */
     public Node(String name, String prototype, WrappedNodeManager nmgr) {
+        if (nmgr == null) {
+            throw new NullPointerException("nmgr");
+        }
         this.nmgr = nmgr;
         this.prototype = prototype;
         dbmap = nmgr.getDbMapping(prototype);
@@ -158,6 +164,9 @@
      */
     public synchronized void init(DbMapping dbm, String id, String name, String prototype,
                 Hashtable propMap, WrappedNodeManager nmgr) {
+        if (nmgr == null) {
+            throw new NullPointerException("nmgr");
+        }
         this.nmgr = nmgr;
         this.dbmap = dbm;
         this.prototype = prototype;
@@ -588,15 +597,6 @@
     /**
      *
      *
-     * @param nmgr
-     */
-    public void setWrappedNodeManager(WrappedNodeManager nmgr) {
-        this.nmgr = nmgr;
-    }
-
-    /**
-     *
-     *
      * @return ...
      */
     public Key getKey() {