Author: markt Date: Tue Aug 16 12:44:30 2011 New Revision: 1158240 URL: http://svn.apache.org/viewvc?rev=1158240&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48717 Call sessionDidActivate when replicating sessions
Modified: tomcat/tc5.5.x/trunk/STATUS.txt tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/LocalStrings.properties tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Modified: tomcat/tc5.5.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1158240&r1=1158239&r2=1158240&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/STATUS.txt (original) +++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Aug 16 12:44:30 2011 @@ -31,16 +31,6 @@ PATCHES PROPOSED TO BACKPORT: +1: kkolinko, markt -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48717 - Call sessionDidActivate when replicating sessions - https://issues.apache.org/bugzilla/attachment.cgi?id=26679 - +1: markt, kfujino - +1: kkolinko: I am not sure that DeltaSession#readObject() is a good - place to call activate - I am not comfortable with this method having - side effects, but I do not see a better solution, and this is a fix - for an issue that is a regression and affects users. - -1: - * Fix possible threading issue in JSP compilation when development mode is enabled http://svn.apache.org/viewvc?rev=1078409&view=rev Modified: tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java?rev=1158240&r1=1158239&r2=1158240&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java (original) +++ tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaSession.java Tue Aug 16 12:44:30 2011 @@ -36,6 +36,7 @@ import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionActivationListener; import javax.servlet.http.HttpSessionAttributeListener; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; @@ -1433,6 +1434,36 @@ public class DeltaSession implements Htt if (notes == null) { notes = new Hashtable(); } + activate(); + } + + /** + * Perform internal processing required to activate this + * session. + */ + private void activate() { + + // Notify interested session event listeners + fireSessionEvent(Session.SESSION_ACTIVATED_EVENT, null); + + // Notify ActivationListeners + HttpSessionEvent event = null; + String keys[] = keys(); + for (int i = 0; i < keys.length; i++) { + Object attribute = attributes.get(keys[i]); + if (attribute instanceof HttpSessionActivationListener) { + if (event == null) + event = new HttpSessionEvent(getSession()); + try { + ((HttpSessionActivationListener)attribute) + .sessionDidActivate(event); + } catch (Throwable t) { + manager.getContainer().getLogger().error + (sm.getString("deltaSession.attributeEvent"), t); + } + } + } + } /** Modified: tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/LocalStrings.properties?rev=1158240&r1=1158239&r2=1158240&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/LocalStrings.properties (original) +++ tomcat/tc5.5.x/trunk/container/modules/cluster/src/share/org/apache/catalina/cluster/session/LocalStrings.properties Tue Aug 16 12:44:30 2011 @@ -59,6 +59,7 @@ deltaManager.waitForSessionState=Manager deltaManager.unableSerializeSessionID =Unable to serialize sessionID [{0}] deltaRequest.showPrincipal=Principal [{0}] is set to session {1} deltaRequest.wrongPrincipalClass=DeltaManager only support GenericPrincipal. Your realm used principal class {0}. +deltaSession.attributeEvent=Session attribute event listener threw exception deltaSession.notifying=Notifying cluster of expiration primary={0} sessionId [{1}] deltaSession.valueBound.ex=Session bound listener throw an exception deltaSession.valueBinding.ex=Session binding listener throw an exception Modified: tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java?rev=1158240&r1=1158239&r2=1158240&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java (original) +++ tomcat/tc5.5.x/trunk/container/modules/ha/src/share/org/apache/catalina/ha/session/DeltaSession.java Tue Aug 16 12:44:30 2011 @@ -614,6 +614,7 @@ public class DeltaSession extends Standa if (notes == null) { notes = new Hashtable(); } + activate(); } public synchronized void writeExternal(ObjectOutput out ) throws java.io.IOException { Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml?rev=1158240&r1=1158239&r2=1158240&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml (original) +++ tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Tue Aug 16 12:44:30 2011 @@ -88,6 +88,9 @@ <subsection name="Cluster"> <changelog> <fix> + <bug>48717</bug>: Ensure session activation events are fired. (markt) + </fix> + <fix> <bug>50771</bug>: Ensure HttpServletRequest#getAuthType() returns the name of the authentication scheme if request has already been authenticated. (kfujino) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org