diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java @ 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 f953c9a559d8
line wrap: on
line diff
--- 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