[gatein-commits] gatein SVN: r1950 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Mar 3 11:27:38 EST 2010


Author: chris.laprun at jboss.com
Date: 2010-03-03 11:27:38 -0500 (Wed, 03 Mar 2010)
New Revision: 1950

Modified:
   components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java
Log:
- Minor optimization.
- Changed SESSION_ID_PREFIX value to org.gatein.wsrp.session. to be more consistent.

Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java	2010-03-03 16:01:31 UTC (rev 1949)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java	2010-03-03 16:27:38 UTC (rev 1950)
@@ -1,6 +1,6 @@
 /*
  * JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
  * contributors as indicated by the @authors tag. See the
  * copyright.txt in the distribution for a full listing of
  * individual contributors.
@@ -41,11 +41,11 @@
 
 import javax.servlet.http.HttpSession;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Manages session informations on behalf of a consumer.
@@ -63,10 +63,10 @@
    private CookieProtocol requiresInitCookie;
 
    /** The prefix used to isolate WSRP-related session information in the actual session object. */
-   private static final String SESSION_ID_PREFIX = "org.jboss.portal.wsrp.session.";
+   private static final String SESSION_ID_PREFIX = "org.gatein.wsrp.session.";
 
    /** session id -> ProducerSessionInformation */
-   private Map<String, ProducerSessionInformation> sessionInfos = new HashMap<String, ProducerSessionInformation>(); // todo: thread-safe?
+   private Map<String, ProducerSessionInformation> sessionInfos = new ConcurrentHashMap<String, ProducerSessionInformation>(); // todo: thread-safe?
 
    /**
     * Constructs a new SessionHandler.
@@ -216,7 +216,10 @@
    {
       ProducerSessionInformation sessionInfo = getProducerSessionInformation(invocation, true);
       ProducerSessionInformation currentSessionInfo = RequestHeaderClientHandler.getCurrentProducerSessionInformation();
-      sessionInfo.replaceUserCookiesWith(currentSessionInfo);
+      if (sessionInfo != currentSessionInfo)
+      {
+         sessionInfo.replaceUserCookiesWith(currentSessionInfo);
+      }
    }
 
    ProducerSessionInformation getProducerSessionInformation(PortletInvocation invocation)



More information about the gatein-commits mailing list