portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r995295 - in /portals/jetspeed-2/portal/trunk: ./ components/jetspeed-portal/ components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/ components/jets...
Date Thu, 09 Sep 2010 02:28:02 GMT
Author: woonsan
Date: Thu Sep  9 02:28:01 2010
New Revision: 995295

URL: http://svn.apache.org/viewvc?rev=995295&view=rev
Log:
Adding concurrent servlet request handling decoration for some platform (possibly for WebSphere
6.1.x) where the underlying request object of the container could have been designed in a
non-thread-safe way. This can make problems when parallel rendering option is enabled.
Using cglib to generate proxy object based on class.
By the way, the asm dependencies have been removed because they are not explicitly used and
the cglib 2.x conflicts with asm 2.x. The cglib 2.x includes asm 1.5.x transitively.
TODO: test with various application server platform with parallel rendering option.

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentContainerRequestResponseUnwrapper.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentRequestMethodInterceptor.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/ThreadLocalHashMap.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/invoker/
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/invoker/TestConcurrentContainerRequestResponseUnwrapper.java
Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml
    portals/jetspeed-2/portal/trunk/pom.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml?rev=995295&r1=995294&r2=995295&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/pom.xml Thu Sep  9 02:28:01
2010
@@ -144,14 +144,6 @@
       <artifactId>jaxen</artifactId>
     </dependency>
     <dependency>
-      <groupId>asm</groupId>
-      <artifactId>asm</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>asm</groupId>
-      <artifactId>asm-attrs</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-commonj_1.1_spec</artifactId>
       <scope>provided</scope>
@@ -160,6 +152,10 @@
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+    </dependency>
     <!-- for spring-core we require JCL -->
     <dependency>
       <groupId>org.slf4j</groupId>

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentContainerRequestResponseUnwrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentContainerRequestResponseUnwrapper.java?rev=995295&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentContainerRequestResponseUnwrapper.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentContainerRequestResponseUnwrapper.java
Thu Sep  9 02:28:01 2010
@@ -0,0 +1,131 @@
+/*
+ * 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.container.invoker;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.UndeclaredThrowableException;
+import net.sf.cglib.transform.impl.UndeclaredThrowableStrategy;
+
+/**
+ * ConcurrentContainerRequestResponseUnwrapper
+ *
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class ConcurrentContainerRequestResponseUnwrapper implements ContainerRequestResponseUnwrapper
+{
+    private Class<?> proxySuperClass;
+    private Class<?> [] proxyConstructorArgTypes;
+    private Object [] proxyConstructorArgs;
+    private String [] attributableProperties;
+    
+    private Enhancer enhancer;
+    
+    public Class<?> getProxySuperClass()
+    {
+        return proxySuperClass;
+    }
+
+    public void setProxySuperClass(Class<?> proxySuperClass)
+    {
+        this.proxySuperClass = proxySuperClass;
+    }
+
+    public Class<?>[] getProxyConstructorArgTypes()
+    {
+        return proxyConstructorArgTypes;
+    }
+
+    public void setProxyConstructorArgTypes(Class<?>[] proxyConstructorArgTypes)
+    {
+        this.proxyConstructorArgTypes = proxyConstructorArgTypes;
+    }
+
+    public Object[] getProxyConstructorArgs()
+    {
+        return proxyConstructorArgs;
+    }
+
+    public void setProxyConstructorArgs(Object[] proxyConstructorArgs)
+    {
+        this.proxyConstructorArgs = proxyConstructorArgs;
+    }
+    
+    public String[] getAttributableProperties()
+    {
+        return attributableProperties;
+    }
+
+    public void setAttributableProperties(String[] attributableProperties)
+    {
+        this.attributableProperties = attributableProperties;
+    }
+
+    public ServletRequest unwrapContainerRequest(HttpServletRequest containerRequest)
+    {
+        ServletRequest request = containerRequest;
+        
+        while (request instanceof HttpServletRequestWrapper)
+        {
+            request = ((HttpServletRequestWrapper) request).getRequest();
+        }
+        
+        if (enhancer == null)
+        {
+            ConcurrentRequestMethodInterceptor interceptor = new ConcurrentRequestMethodInterceptor(request);
+            
+            if (attributableProperties != null)
+            {
+                interceptor.setAttributableProperties(attributableProperties);
+            }
+            
+            enhancer = new Enhancer();
+            enhancer.setSuperclass(proxySuperClass != null ? proxySuperClass : request.getClass());
+            enhancer.setStrategy(new UndeclaredThrowableStrategy(UndeclaredThrowableException.class));
+            enhancer.setInterceptDuringConstruction(false);
+            enhancer.setCallback(interceptor);
+        }
+        
+        if (proxyConstructorArgTypes != null && proxyConstructorArgTypes.length >
0)
+        {
+            request = (ServletRequest) enhancer.create(proxyConstructorArgTypes, proxyConstructorArgs);
+        }
+        else
+        {
+            request = (ServletRequest) enhancer.create();
+        }
+        
+        return request;
+    }
+    
+    public ServletResponse unwrapContainerResponse(HttpServletResponse containerResponse)
+    {
+        if (containerResponse instanceof HttpServletResponseWrapper)
+        {
+            return ((HttpServletResponseWrapper) containerResponse).getResponse();
+        }
+        
+        return containerResponse;
+    }
+}

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentRequestMethodInterceptor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentRequestMethodInterceptor.java?rev=995295&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentRequestMethodInterceptor.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/invoker/ConcurrentRequestMethodInterceptor.java
Thu Sep  9 02:28:01 2010
@@ -0,0 +1,186 @@
+/*
+ * 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.container.invoker;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.jetspeed.util.ThreadLocalHashMap;
+
+/**
+ * ConcurrentRequestMethodInterceptor
+ * 
+ * @version $Id$
+ */
+public class ConcurrentRequestMethodInterceptor implements MethodInterceptor
+{
+    private static final String DEFAULT_PROPERTY_ATTRIBUTE_PREFIX = ConcurrentRequestMethodInterceptor.class.getName()
+ ".";
+    
+    private Object requestObject;
+    private ThreadLocalHashMap<String, Object> attributes;
+    private boolean synchronizeRequestObjectOnDefaultInvocation = true;
+    private Set<String> attributableProperties;
+    private boolean hasAttributableProperties = false;
+    private String propertyAttributePrefix = DEFAULT_PROPERTY_ATTRIBUTE_PREFIX;
+    
+    public ConcurrentRequestMethodInterceptor(Object requestObject)
+    {
+        this.requestObject = requestObject;
+        attributes = new ThreadLocalHashMap<String, Object>();
+    }
+    
+    public void setSynchronizeRequestObjectOnDefaultInvocation(boolean synchronizeRequestObjectOnDefaultInvocation)
+    {
+        this.synchronizeRequestObjectOnDefaultInvocation = synchronizeRequestObjectOnDefaultInvocation;
+    }
+    
+    public boolean getSynchronizeRequestObjectOnDefaultInvocation()
+    {
+        return synchronizeRequestObjectOnDefaultInvocation;
+    }
+    
+    public void setAttributableProperties(final String [] attributableProperties)
+    {
+        this.attributableProperties = new HashSet<String>();
+        
+        for (String attributableProperty : attributableProperties)
+        {
+            this.attributableProperties.add(attributableProperty);
+        }
+        
+        this.hasAttributableProperties = !this.attributableProperties.isEmpty();
+    }
+    
+    public String [] getAttributableProperties()
+    {
+        if (attributableProperties == null || attributableProperties.isEmpty())
+        {
+            return new String[0];
+        }
+        
+        String [] arr = new String[attributableProperties.size()];
+        
+        int index = 0;
+        for (String attributableProperty : attributableProperties)
+        {
+            arr[index++] = attributableProperty;
+        }
+        
+        return arr;
+    }
+    
+    public void setPropertyAttributePrefix(String propertyAttributePrefix)
+    {
+        this.propertyAttributePrefix = propertyAttributePrefix;
+    }
+    
+    public String getPropertyAttributePrefix()
+    {
+        return propertyAttributePrefix;
+    }
+    
+    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
throws Throwable
+    {
+        if (Modifier.isAbstract(method.getModifiers()))
+        {
+            return null;
+        }
+        
+        String methodName = method.getName();
+        
+        if ("getAttribute".equals(methodName))
+        {
+            if (attributes.containsKey((String) args[0])) 
+            {
+                return attributes.get((String) args[0]);
+            }
+        }
+        else if ("setAttribute".equals(methodName))
+        {
+            attributes.put((String) args[0], args[1]);
+        }
+        else if ("removeAttribute".equals(methodName))
+        {
+            attributes.remove((String) args[0]);
+        }
+        else if (hasAttributableProperties)
+        {
+            if (methodName.startsWith("get") && args.length == 0)
+            {
+                String propName = getPropertyName(method);
+                
+                if (propName != null && attributableProperties.contains(propName))
+                {
+                    String attrName = propertyAttributePrefix + propName;
+                    
+                    if (attributes.containsKey(attrName))
+                    {
+                        return attributes.get(attrName);
+                    }
+                }
+            }
+            else if (methodName.startsWith("set") && args.length == 1)
+            {
+                String propName = getPropertyName(method);
+                
+                if (propName != null && attributableProperties.contains(propName))
+                {
+                    String attrName = propertyAttributePrefix + propName;
+                    attributes.put(attrName, args[0]);
+                }
+            }
+        }
+        
+        if (synchronizeRequestObjectOnDefaultInvocation)
+        {
+            synchronized (requestObject)
+            {
+                return method.invoke(requestObject, args);
+            }
+        }
+        else
+        {
+            return method.invoke(requestObject, args);
+        }
+    }
+    
+    private String getPropertyName(final Method method)
+    {
+        String name = method.getName();
+        
+        if (name.startsWith("get") || name.startsWith("set"))
+        {
+            char firstChar = name.charAt(3);
+            
+            if (Character.isUpperCase(firstChar))
+            {
+                StringBuilder sb = new StringBuilder(name.substring(3));
+                sb.setCharAt(0, Character.toLowerCase(firstChar));
+                name = sb.toString();
+            }
+            
+            return name;
+        }
+        
+        return null;
+    }
+}

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/ThreadLocalHashMap.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/ThreadLocalHashMap.java?rev=995295&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/ThreadLocalHashMap.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/util/ThreadLocalHashMap.java
Thu Sep  9 02:28:01 2010
@@ -0,0 +1,169 @@
+/*
+ * 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.util;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * ThreadLocalHashMap
+ * @param <K>
+ * @param <V>
+ * @version $Id$
+ */
+public class ThreadLocalHashMap<K, V> implements Map<K, V>
+{
+    private static ThreadLocal<Map<?, ?>> tlMap = new ThreadLocal<Map<?,
?>>();
+    
+    public ThreadLocalHashMap()
+    {
+        this(true);
+    }
+    
+    public ThreadLocalHashMap(boolean clear)
+    {
+        clear();
+    }
+    
+    public int size()
+    {
+        Map<K, V> map = getThreadLocalMap();
+        return (map == null ? 0 : map.size());
+    }
+    
+    public boolean isEmpty()
+    {
+        Map<K, V> map = getThreadLocalMap();
+        return (map == null ? true : map.isEmpty());
+    }
+
+    public boolean containsKey(Object key)
+    {
+        Map<K, V> map = getThreadLocalMap();
+        return (map == null ? false : map.containsKey(key));
+    }
+    
+    public boolean containsValue(Object value)
+    {
+        Map<K, V> map = getThreadLocalMap();
+        return (map == null ? false : map.containsValue(value));
+    }
+
+    public V get(Object key)
+    {
+        Map<K, V> map = getThreadLocalMap();
+        return (map == null ? null : map.get(key));
+    }
+
+    public V put(K key, V value)
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map == null)
+        {
+            map = new HashMap<K, V>();
+            setThreadLocalMap(map);
+        }
+        
+        return map.put(key, value);
+    }
+
+    public V remove(Object key)
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map != null)
+        {
+            return map.remove(key);
+        }
+        
+        return null;
+    }
+
+    public void putAll(Map<? extends K, ? extends V> m)
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map == null)
+        {
+            map = new HashMap<K, V>();
+            setThreadLocalMap(map);
+        }
+        
+        map.putAll(m);
+    }
+
+    public void clear()
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map != null)
+        {
+            map.clear();
+        }
+    }
+    
+    public Set<K> keySet()
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map != null)
+        {
+            return map.keySet();
+        }
+        
+        return Collections.emptySet();
+    }
+
+    public Collection<V> values()
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map != null)
+        {
+            return map.values();
+        }
+        
+        return Collections.emptyList();
+    }
+
+    public Set<Map.Entry<K, V>> entrySet()
+    {
+        Map<K, V> map = getThreadLocalMap();
+        
+        if (map != null)
+        {
+            return map.entrySet();
+        }
+        
+        return Collections.emptySet();
+    }
+    
+    @SuppressWarnings("unchecked")
+    private Map<K, V> getThreadLocalMap()
+    {
+        return (Map<K, V>) tlMap.get();
+    }
+    
+    private void setThreadLocalMap(Map<K, V> map)
+    {
+        tlMap.set(map);
+    }
+}

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/invoker/TestConcurrentContainerRequestResponseUnwrapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/invoker/TestConcurrentContainerRequestResponseUnwrapper.java?rev=995295&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/invoker/TestConcurrentContainerRequestResponseUnwrapper.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/container/invoker/TestConcurrentContainerRequestResponseUnwrapper.java
Thu Sep  9 02:28:01 2010
@@ -0,0 +1,171 @@
+/*
+ * 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.container.invoker;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.UndeclaredThrowableException;
+import net.sf.cglib.transform.impl.UndeclaredThrowableStrategy;
+
+/**
+ * TestConcurrentContainerRequestResponseUnwrapper
+ * @version $Id$
+ */
+public class TestConcurrentContainerRequestResponseUnwrapper extends TestCase 
+{
+    private Enhancer enhancer;
+    private ConcurrentRequest concurrentRequest;
+
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        
+        concurrentRequest = new ConcurrentRequest(null);
+        
+        ConcurrentRequestMethodInterceptor interceptor = new ConcurrentRequestMethodInterceptor(concurrentRequest);
+        interceptor.setAttributableProperties(new String [] { "dispatcherContext" });
+        
+        enhancer = new Enhancer();
+        enhancer.setSuperclass(ConcurrentRequest.class);
+        enhancer.setStrategy(new UndeclaredThrowableStrategy(UndeclaredThrowableException.class));
+        enhancer.setInterceptDuringConstruction(false);
+        enhancer.setCallback(interceptor);
+        
+        concurrentRequest = (ConcurrentRequest) enhancer.create(new Class[] { ConcurrentRequest.class
}, new Object[] { null });
+    }
+
+    public void testThreadSafety() throws Exception
+    {
+        int workerCount = 40;
+        Worker[] workers = new Worker[workerCount];
+        
+        for (int i = 0; i < workerCount; i++)
+        {
+            workers[i] = new Worker("Worker-" + i, concurrentRequest, "Portlet-" + i, new
Object());
+        }
+        
+        for (int i = 0; i < workerCount; i++)
+        {
+            workers[i].start();
+        }
+        
+        for (int i = 0; i < workerCount; i++)
+        {
+            workers[i].join();
+        }
+        
+        for (int i = 0; i < workerCount; i++)
+        {
+            assertEquals("Difference-1: " + workers[i].getOriginalPortletName() + ", " +
workers[i].getCurrentPortletName(), 
+                         workers[i].getOriginalPortletName(),
+                         workers[i].getCurrentPortletName());
+            assertEquals("Difference-2: " + workers[i].getOriginalWebAppDispatcherContext()
+ ", " + workers[i].getCurrentWebAppDispatcherContext(), 
+                         workers[i].getOriginalWebAppDispatcherContext(),
+                         workers[i].getCurrentWebAppDispatcherContext());
+        }
+    }
+
+    private static class Worker extends Thread
+    {
+        private final ConcurrentRequest concurrentRequest;
+        private final String orginalPortletName;
+        private String currentPortletName;
+        private final Object originalWebAppDispatcherContext;
+        private Object currentWebAppDispatcherContext;
+
+        private Worker(String name, final ConcurrentRequest concurrentRequest, final String
orginalPortletName, final Object originalWebAppDispatcherContext)
+        {
+            super(name);
+            this.concurrentRequest = concurrentRequest;
+            this.orginalPortletName = orginalPortletName;
+            this.originalWebAppDispatcherContext = originalWebAppDispatcherContext;
+        }
+
+        public void run()
+        {
+            concurrentRequest.setAttribute("portletName", orginalPortletName);
+            concurrentRequest.setDispatcherContext(originalWebAppDispatcherContext);
+            
+            try
+            {
+                Thread.sleep(10);
+            }
+            catch (Exception e)
+            {
+            }
+            
+            currentPortletName = (String) concurrentRequest.getAttribute("portletName");
+            currentWebAppDispatcherContext = concurrentRequest.getDispatcherContext();
+        }
+
+        public String getOriginalPortletName()
+        {
+            return orginalPortletName;
+        }
+
+        public String getCurrentPortletName()
+        {
+            return currentPortletName;
+        }
+
+        public Object getOriginalWebAppDispatcherContext()
+        {
+            return originalWebAppDispatcherContext;
+        }
+
+        public Object getCurrentWebAppDispatcherContext()
+        {
+            return currentWebAppDispatcherContext;
+        }
+    }
+    
+    public static class ConcurrentRequest
+    {
+        private Map<String, Object> attributes;
+        private Object dispatcherContext;
+        
+        public ConcurrentRequest(ConcurrentRequest parent)
+        {
+            this.attributes = Collections.synchronizedMap(new HashMap<String, Object>());
+        }
+        
+        public void setAttribute(String s, Object obj)
+        {
+            attributes.put(s, obj);
+        }
+        
+        public Object getAttribute(String s)
+        {
+            return attributes.get(s);
+        }
+        
+        public void setDispatcherContext(Object dispatcherContext)
+        {
+            this.dispatcherContext = dispatcherContext;
+        }
+        
+        public Object getDispatcherContext()
+        {
+            return dispatcherContext;
+        }
+    }
+
+}

Modified: portals/jetspeed-2/portal/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/pom.xml?rev=995295&r1=995294&r2=995295&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/pom.xml Thu Sep  9 02:28:01 2010
@@ -313,7 +313,6 @@
     <xalan.version>2.4.1</xalan.version>
     <xerces.version>2.8.1</xerces.version>
     <xml-apis.version>2.0.2</xml-apis.version>
-    <asm.version>2.2</asm.version>
     <ccpp.version>1.0</ccpp.version>
     <geronimo-commonj_1.1_spec.version>1.0</geronimo-commonj_1.1_spec.version>
     <tyrex.version>1.0.1</tyrex.version>
@@ -625,19 +624,15 @@
           </exclusion>
         </exclusions>
       </dependency>
-
-      <!-- Spring Framework -->
+      
+      <!-- CGLIB -->
       <dependency>
         <groupId>cglib</groupId>
         <artifactId>cglib</artifactId>
         <version>${cglib.version}</version>
-        <exclusions>
-          <exclusion>
-            <groupId>asm</groupId>
-            <artifactId>asm</artifactId>
-          </exclusion>
-        </exclusions>
       </dependency>
+      
+      <!-- Spring Framework -->
       <dependency>
         <groupId>aopalliance</groupId>
         <artifactId>aopalliance</artifactId>
@@ -1378,18 +1373,6 @@
         <version>${ant.version}</version>
       </dependency>
 
-      <!-- ASM -->
-      <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm</artifactId>
-        <version>${asm.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>asm</groupId>
-        <artifactId>asm-attrs</artifactId>
-        <version>${asm.version}</version>
-      </dependency>
-
       <!-- geronimo-commonj_1.1_spec -->
       <dependency>
         <groupId>org.apache.geronimo.specs</groupId>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message