Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 34964 invoked from network); 16 Apr 2003 18:49:44 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 16 Apr 2003 18:49:44 -0000 Received: (qmail 26804 invoked by uid 97); 16 Apr 2003 18:51:42 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@nagoya.betaversion.org Received: (qmail 26797 invoked from network); 16 Apr 2003 18:51:41 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 16 Apr 2003 18:51:41 -0000 Received: (qmail 33206 invoked by uid 500); 16 Apr 2003 18:49:24 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 33145 invoked by uid 500); 16 Apr 2003 18:49:24 -0000 Received: (qmail 33042 invoked from network); 16 Apr 2003 18:49:23 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 16 Apr 2003 18:49:23 -0000 Received: (qmail 61396 invoked by uid 1602); 16 Apr 2003 18:49:22 -0000 Date: 16 Apr 2003 18:49:22 -0000 Message-ID: <20030416184922.61395.qmail@icarus.apache.org> From: fhanik@apache.org To: jakarta-tomcat-catalina-cvs@apache.org Subject: cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp ReplicationValve.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N fhanik 2003/04/16 11:49:22 Modified: modules/cluster/src/share/org/apache/catalina/cluster/session ReplicatedSession.java SimpleTcpReplicationManager.java modules/cluster/src/share/org/apache/catalina/cluster/tcp ReplicationValve.java Log: fixed a bug in deserialization of sessions, also improved logging a little bit Revision Changes Path 1.5 +10 -7 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicatedSession.java Index: ReplicatedSession.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/ReplicatedSession.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ReplicatedSession.java 4 Apr 2003 19:43:47 -0000 1.4 +++ ReplicatedSession.java 16 Apr 2003 18:49:22 -0000 1.5 @@ -238,13 +238,16 @@ } public String toString() { - StringBuffer buf = new StringBuffer("[ReplicatedSession] Id").append(getId()); java.util.Enumeration e = getAttributeNames(); + StringBuffer buf = new StringBuffer("ReplicatedSession id="); + buf.append(getId()).append(" ref=").append(super.toString()).append("\n"); + java.util.Enumeration e = getAttributeNames(); while ( e.hasMoreElements() ) { String name = (String)e.nextElement(); - Object value = this.getAttribute(name); - buf.append("\n\t"+name+"="+value); + Object value = getAttribute(name); + buf.append("\tname=").append(name).append("; value=").append(value).append("\n"); } + buf.append("\tLastAccess=").append(getLastAccessedTime()).append("\n"); return buf.toString(); - } + } 1.7 +21 -5 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java Index: SimpleTcpReplicationManager.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/session/SimpleTcpReplicationManager.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- SimpleTcpReplicationManager.java 16 Apr 2003 04:07:49 -0000 1.6 +++ SimpleTcpReplicationManager.java 16 Apr 2003 18:49:22 -0000 1.7 @@ -204,7 +204,7 @@ public void setDebug(int debug) { this.debug = debug; - super.setDebug(debug); + //super.setDebug(debug); } /** * Creates a HTTP session. @@ -317,6 +317,11 @@ //return immediately if the session is not dirty if ( useDirtyFlag && (!session.isDirty())) return null; session.setIsDirty(false); + if (getDebug()>5) { + try { + log.debug("Sending session to cluster="+session); + }catch ( Exception ignore) {} + } SessionMessage msg = new SessionMessage(name,SessionMessage.EVT_SESSION_CREATED, writeSession(session), session.getId()); @@ -376,7 +381,15 @@ { java.io.ByteArrayInputStream session_data = new java.io.ByteArrayInputStream(data); ReplicationStream session_in = new ReplicationStream(session_data,container.getLoader().getClassLoader()); + Session session = sessionId!=null?this.findSession(sessionId):null; + //clear the old values from the existing session + if ( session!=null ) { + ReplicatedSession rs = (ReplicatedSession)session; + rs.expire(false); + session = null; + }//end if + if (session==null) session = createSession(false,false); boolean hasPrincipal = session_in.readBoolean(); SerializablePrincipal p = null; @@ -524,6 +537,9 @@ Session session = this.readSession(msg.getSession(),msg.getSessionID()); session.setManager(this); add(session); + session.setValid(true); + session.access(); + if ( getDebug() > 5 ) log("Received replicated session="+session); break; } default: { @@ -534,7 +550,7 @@ } catch ( Exception x ) { - log("Unable to receive message through javagroups channel",x,1); + log("Unable to receive message through TCP channel",x,1); } } 1.3 +6 -19 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationValve.java Index: ReplicationValve.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationValve.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ReplicationValve.java 20 Mar 2003 20:46:14 -0000 1.2 +++ ReplicationValve.java 16 Apr 2003 18:49:22 -0000 1.3 @@ -263,13 +263,7 @@ */ protected void log(String message,int level) { if ( debug < level ) return; - Logger logger = null; - if ( container != null ) logger = container.getLogger(); - if (logger != null) - logger.log(this.toString() + ": " + message); - else - System.out.println(this.toString() + ": " + message); - + log.debug(message); } @@ -281,14 +275,7 @@ */ protected void log(String message, Throwable throwable,int level) { if ( debug < level ) return; - Logger logger = null; - if ( container != null ) logger = container.getLogger(); - if (logger != null) - logger.log(this.toString() + ": " + message, throwable); - else { - log.warn(message,throwable); - } - + log.debug(message,throwable); } --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org