Author: taylor
Date: Sat Jul 12 18:54:36 2014
New Revision: 1610023
URL: http://svn.apache.org/r1610023
Log:
JS2-1294: applying concurrency issue patch from Joachim Mueller to 2.2.3 release branch
Modified:
portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java
portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java
portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/test/java/org/apache/jetspeed/decoration/TestDecorations.java
portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java?rev=1610023&r1=1610022&r2=1610023&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/HashMapPathResolverCache.java Sat Jul 12 18:54:36 2014
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jetspeed.decoration.caches;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.jetspeed.decoration.PathResolverCache;
-
-
-/**
- * Uses a <code>java.util.HashMap</code> to cache previously located
- * resources pathes.
- *
- * @author <href a="mailto:[email protected]">Scott T. Weaver</a>
- *
- */
-public class HashMapPathResolverCache implements PathResolverCache
-{
- protected Map<String,String> cache;
-
- public HashMapPathResolverCache()
- {
- this.cache = Collections.synchronizedMap(new HashMap<String,String>());
- }
-
- public void addPath(String key, String path)
- {
- cache.put(key, path);
- }
-
- public String getPath(String key)
- {
- return cache.get(key);
- }
-
- public String removePath(String key)
- {
- return cache.remove(key);
- }
-
- public void clear()
- {
- cache.clear();
- }
-
-}
Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java?rev=1610023&r1=1610022&r2=1610023&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/main/java/org/apache/jetspeed/decoration/caches/SessionPathResolverCache.java Sat Jul 12 18:54:36 2014
@@ -16,35 +16,54 @@
*/
package org.apache.jetspeed.decoration.caches;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpSession;
-
import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.decoration.PathResolverCache;
+import javax.servlet.http.HttpSession;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
/**
* Extends the
*
* @author <href a="mailto:[email protected]">Scott T. Weaver</a>
*
*/
-public class SessionPathResolverCache extends HashMapPathResolverCache implements PathResolverCache
+public class SessionPathResolverCache implements PathResolverCache
{
- public SessionPathResolverCache(HttpSession session)
+
+ private Map<String,String> cache = null;
+
+ public SessionPathResolverCache(HttpSession session)
{
- cache = (Map) session.getAttribute(PortalReservedParameters.RESOVLER_CACHE_ATTR);
-
+ cache = (Map) session.getAttribute(PortalReservedParameters.RESOLVER_CACHE_ATTR);
if(cache == null)
{
- cache = new HashMap();
- session.setAttribute(PortalReservedParameters.RESOVLER_CACHE_ATTR, cache);
+ cache = new ConcurrentHashMap<String, String>();
+ session.setAttribute(PortalReservedParameters.RESOLVER_CACHE_ATTR, cache);
}
}
- public void clear()
- {
+ @Override
+ public void clear() {
cache.clear();
}
+
+ @Override
+ public void addPath(String key, String path) {
+ cache.put(key, path);
+
+ }
+
+ @Override
+ public String getPath(String key) {
+ return cache.get(key);
+ }
+
+ @Override
+ public String removePath(String key) {
+ return cache.remove(key);
+ }
+
+
}
Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/test/java/org/apache/jetspeed/decoration/TestDecorations.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/test/java/org/apache/jetspeed/decoration/TestDecorations.java?rev=1610023&r1=1610022&r2=1610023&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/test/java/org/apache/jetspeed/decoration/TestDecorations.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/components/jetspeed-portal/src/test/java/org/apache/jetspeed/decoration/TestDecorations.java Sat Jul 12 18:54:36 2014
@@ -16,16 +16,6 @@
*/
package org.apache.jetspeed.decoration;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Properties;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
import org.apache.jetspeed.PortalReservedParameters;
import org.apache.jetspeed.om.page.ContentFragment;
import org.apache.jetspeed.om.page.ContentPage;
@@ -36,6 +26,15 @@ import org.jmock.MockObjectTestCase;
import org.jmock.core.Constraint;
import org.jmock.core.InvocationMatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Properties;
+
public class TestDecorations extends MockObjectTestCase
{
private Path testPathHtmlEn;
@@ -256,8 +255,7 @@ public class TestDecorations extends Moc
expectAndReturn(atLeastOnce(), servletRequestMock, "getSession", sessionMock.proxy());
expectAndReturn(atLeastOnce(), requestContextMock, "getRequest", servletRequestMock.proxy());
- expectAndReturn(atLeastOnce(), sessionMock, "getAttribute", new Constraint[]{eq(PortalReservedParameters.RESOVLER_CACHE_ATTR)}, new HashMap());
- //expectAndReturn(sessionMock, "getAttribute", PortalReservedParameters.RESOVLER_CACHE_ATTR);
+ expectAndReturn(atLeastOnce(), sessionMock, "getAttribute", new Constraint[]{eq(PortalReservedParameters.RESOLVER_CACHE_ATTR)}, new HashMap());
expectAndReturn(childFragmentMock, "getDecorator", "myPortletDecoration");
Modified: portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java?rev=1610023&r1=1610022&r2=1610023&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-BRANCH-2.2.2-POST-RELEASE/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java Sat Jul 12 18:54:36 2014
@@ -65,7 +65,7 @@ public interface PortalReservedParameter
public static final String PATH_ATTRIBUTE = "org.apache.jetspeed.Path";
public static final String CONTENT_PATH_ATTRIBUTE = "org.apache.jetspeed.ContentPath";
public static final String PARAMETER_ALREADY_DECODED_ATTRIBUTE = "org.apache.jetspeed.parameterAlreadyDecoded";
- public static final String RESOVLER_CACHE_ATTR = "org.apache.jetspeed.resovler.cache";
+ public static final String RESOLVER_CACHE_ATTR = "org.apache.jetspeed.resolver.cache";
public static final String PORTLET_DEFINITION_ATTRIBUTE = "org.apache.jetspeed.portlet.definition";
public static final String PORTLET_WINDOW_ATTRIBUTE = "org.apache.jetspeed.portlet.window";
public static final String PORTLET_FILTER_MANAGER_ATTRIBUTE = "org.apache.jetspeed.portlet.container.filterManager";
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.