portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r549826 - /portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhPortletContentCacheImpl.java
Date Fri, 22 Jun 2007 14:23:14 GMT
Author: ate
Date: Fri Jun 22 07:23:13 2007
New Revision: 549826

URL: http://svn.apache.org/viewvc?view=rev&rev=549826
Log:
Trap IllegalStateExceptions when a cache might not be alive anymore, like during shutdown.
Noticed this problem while testing with Jetty 

Modified:
    portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhPortletContentCacheImpl.java

Modified: portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhPortletContentCacheImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhPortletContentCacheImpl.java?view=diff&rev=549826&r1=549825&r2=549826
==============================================================================
--- portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhPortletContentCacheImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/cache/impl/EhPortletContentCacheImpl.java
Fri Jun 22 07:23:13 2007
@@ -249,7 +249,7 @@
         
     public void evictContentForUser(String username)
     {
-        Element userElement = ehcache.get(username);
+        Element userElement = saveGet(username);
         if (userElement != null)
         {
             Map map = (Map)userElement.getObjectValue();
@@ -268,7 +268,7 @@
 
     public void evictContentForSession(String session)
     {
-        Element userElement = ehcache.get(session);
+        Element userElement = saveGet(session);
         if (userElement != null)
         {
             Map map = (Map)userElement.getObjectValue();
@@ -295,5 +295,16 @@
         return this.keyGenerator.createCacheKey(context, windowId);        
     }
     
-
+    protected Element saveGet(Object key)
+    {
+        try
+        {
+            return ehcache.get(key);
+        }
+        catch (IllegalStateException ise)
+        {
+            // can be thrown during shutdown for instance
+            return null;
+        }
+    }
 }



---------------------------------------------------------------------
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