]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/Node.java
Performance improvements for ParentNode in scene graph
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / Node.java
index 7ce4611a38e0afd2a807e4d409ba324df6e34285..b9fb1b67fc00ad9d79e9e29221745f64e265e860 100644 (file)
@@ -22,7 +22,13 @@ public abstract class Node implements INode {
 
     private static final long                  serialVersionUID       = -5540999051056414851L;
 
+    /**
+     * The scene graph is essentially single-threaded, meaning nodes should be
+     * created in one thread only. For this reason, we are not using AtomicLong
+     * here.
+     */
     public transient static long               IDCOUNTER              = 1;
+    protected long                             id                     = IDCOUNTER++;
 
     protected transient ParentNode<?>          parent                 = null;
     protected transient Location               location               = Location.LOCAL;
@@ -31,12 +37,10 @@ public abstract class Node implements INode {
     // Support for only one listener should be enough, thus we don't need PropertyChangeSupport
     protected transient PropertyChangeListener propertyChangeListener = null;
 
-    protected Long                             id                     = IDCOUNTER++;
-
     /**
      * @see org.simantics.scenegraph.INode#getId()
      */
-    public Long getId() {
+    public long getId() {
         return id;
     }
 
@@ -78,10 +82,6 @@ public abstract class Node implements INode {
      */
     public void init() {
     }
-    
-    public void attach() {
-    }
-    
 
     /**
      * @see org.simantics.scenegraph.INode#cleanup()