changeset 1062:58b4a07db856

Cach improvement: remove the cached elements of each visited state that is visited while stepping back to a previous state. gnv-artifacts/trunk@1147 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 02 Jun 2010 09:52:39 +0000
parents 13bea93a070a
children 732cea65cee7
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Tue Jun 01 16:59:15 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Wed Jun 02 09:52:39 2010 +0000
@@ -1,3 +1,9 @@
+2010-06-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Remove
+	  cached elements of each state that is visited while stepping back to a
+	  previous state.
+
 2010-06-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Do not
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Tue Jun 01 16:59:15 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Wed Jun 02 09:52:39 2010 +0000
@@ -191,7 +191,9 @@
             }
 
             // step backward
-            else if((next = getPreviousState(current, targetState)) != null) {
+            else if((next = getPreviousState(current, targetState, context))
+                     != null)
+            {
 
                 if (current != null) {
                     current.endOfLife(context.globalContext());
@@ -292,7 +294,9 @@
     /**
      * Step back to the previous state specified by <code>name</code>.
      */
-    protected State getPreviousState(State current, String name) {
+    protected State getPreviousState(
+        State current, String name, CallContext context)
+    {
         if (current == null) {
             return null;
         }
@@ -301,7 +305,8 @@
             return current;
         }
         else {
-            return getPreviousState(current.getParent(), name);
+            current.endOfLife(context);
+            return getPreviousState(current.getParent(), name, context);
         }
     }
 

http://dive4elements.wald.intevation.org