Author: fhanik Date: Tue Aug 22 09:52:29 2006 New Revision: 433689 URL: http://svn.apache.org/viewvc?rev=433689&view=rev Log: Prepare for cluster integration
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=433689&r1=433688&r2=433689&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java Tue Aug 22 09:52:29 2006 @@ -88,7 +88,7 @@ /** * The context attributes for this context. */ - private Map attributes = new ConcurrentHashMap(); + protected Map attributes = new ConcurrentHashMap(); /** Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java?rev=433689&r1=433688&r2=433689&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/session/StandardSession.java Tue Aug 22 09:52:29 2006 @@ -1243,6 +1243,27 @@ * invalidated session */ public void setAttribute(String name, Object value) { + setAttribute(name,value,true); + } + /** + * Bind an object to this session, using the specified name. If an object + * of the same name is already bound to this session, the object is + * replaced. + * <p> + * After this method executes, and if the object implements + * <code>HttpSessionBindingListener</code>, the container calls + * <code>valueBound()</code> on the object. + * + * @param name Name to which the object is bound, cannot be null + * @param value Object to be bound, cannot be null + * @param notify whether to notify session listeners + * @exception IllegalArgumentException if an attempt is made to add a + * non-serializable object in an environment marked distributable. + * @exception IllegalStateException if this method is called on an + * invalidated session + */ + + public void setAttribute(String name, Object value, boolean notify) { // Name cannot be null if (name == null) @@ -1268,7 +1289,7 @@ HttpSessionBindingEvent event = null; // Call the valueBound() method if necessary - if (value instanceof HttpSessionBindingListener) { + if (notify && value instanceof HttpSessionBindingListener) { // Don't call any notification if replacing with the same value Object oldValue = attributes.get(name); if (value != oldValue) { @@ -1286,7 +1307,7 @@ Object unbound = attributes.put(name, value); // Call the valueUnbound() method if necessary - if ((unbound != null) && (unbound != value) && + if (notify && (unbound != null) && (unbound != value) && (unbound instanceof HttpSessionBindingListener)) { try { ((HttpSessionBindingListener) unbound).valueUnbound @@ -1296,7 +1317,9 @@ (sm.getString("standardSession.bindingEvent"), t); } } - + + if ( !notify ) return; + // Notify interested application event listeners Context context = (Context) manager.getContainer(); Object listeners[] = context.getApplicationEventListeners(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]