You are viewing a plain text version of this content. The canonical link for it is here.
Posted to lokahi-commits@incubator.apache.org by to...@apache.org on 2008/02/21 18:41:36 UTC

svn commit: r629912 - /incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java

Author: toback
Date: Thu Feb 21 10:41:35 2008
New Revision: 629912

URL: http://svn.apache.org/viewvc?rev=629912&view=rev
Log:
Fix to moving of the context so that the old pool is not still running the old context.

Modified:
    incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java

Modified: incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java
URL: http://svn.apache.org/viewvc/incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java?rev=629912&r1=629911&r2=629912&view=diff
==============================================================================
--- incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java (original)
+++ incubator/lokahi/lokahi/trunk/src/java/org/apache/lokahi/tomcat/api/entity/TomcatContextModel.java Thu Feb 21 10:41:35 2008
@@ -447,10 +447,27 @@
     this.jpInit(f, u, p, tc.getContextName());
     if (!u.isAllowed(f)) throw new AuthorizationException("User " + u.getName() + " Not allowed to " + f.getName());
     if (tc.getPk() < 1) throw new TMCIllegalArgumentException("Error with input");
+    
+    TomcatContext origContext = TomcatContext.getTomcatContext(tc.getPk());
+    
+    // before we update, check to see if the NEW pool is different than the OLD pool
+    if (origContext.getTomcatPoolId() != tc.getTomcatPoolId()) {
+        // if they are different, undeploy the old context before updating
+    	this.undeployContext(this.jp, p, u, origContext);
+    }
+    
     TomcatContext.update(tc);
     this.installContext(jp, null, u, tc);
     TomcatPoolModel tpm = new TomcatPoolModel();
-    tpm.deployTomcatConfig(u, null, jp, tc.getTomcatPool(), f);
+    
+    // check to see if the NEW pool is different than the OLD pool
+    if (origContext.getTomcatPoolId() != tc.getTomcatPoolId()) {
+    	// if they are different deploy config files to OLD jvm
+    	tpm.deployTomcatConfig(u, null, this.jp, origContext.getTomcatPool(), f);
+    }
+    
+    // deploy config files to NEW jvm
+    tpm.deployTomcatConfig(u, null, this.jp, tc.getTomcatPool(), f);
     jp.setState(State.NEW);
     JobPool.update(jp);
   }
@@ -495,6 +512,7 @@
     return TomcatContext.getTomcatContext(id);
   }
 }
+