You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2004/01/17 04:24:51 UTC
cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/core WorkerEnv.java
billbarker 2004/01/16 19:24:51
Modified: jk/java/org/apache/jk/core WorkerEnv.java
Log:
Fix the problem that every Handler was getting added twice.
Also, fix the case where we are attempting to replace a Handler (only possible if you are using your own JMX code to control Jk).
Revision Changes Path
1.12 +13 -3 jakarta-tomcat-connectors/jk/java/org/apache/jk/core/WorkerEnv.java
Index: WorkerEnv.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/core/WorkerEnv.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WorkerEnv.java 25 Sep 2003 15:24:44 -0000 1.11
+++ WorkerEnv.java 17 Jan 2004 03:24:51 -0000 1.12
@@ -133,6 +133,11 @@
}
public void addHandler( String name, JkHandler w ) {
+ JkHandler oldH = getHandler(name);
+ if(oldH == w) {
+ // Already added
+ return;
+ }
w.setWorkerEnv( this );
w.setName( name );
handlersMap.put( name, w );
@@ -141,9 +146,14 @@
System.arraycopy( handlersTable, 0, newT, 0, handlersTable.length );
handlersTable=newT;
}
- handlersTable[handlerCount]=w;
- w.setId( handlerCount );
- handlerCount++;
+ if(oldH == null) {
+ handlersTable[handlerCount]=w;
+ w.setId( handlerCount );
+ handlerCount++;
+ } else {
+ handlersTable[oldH.getId()]=w;
+ w.setId(oldH.getId());
+ }
// Notify all other handlers of the new one
// XXX Could be a Coyote action ?
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org