portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r380297 - /portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java
Date Fri, 24 Feb 2006 01:52:13 GMT
Author: taylor
Date: Thu Feb 23 17:52:12 2006
New Revision: 380297

URL: http://svn.apache.org/viewcvs?rev=380297&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-495
Using Spring method interceptor to clear OJB cache for Page Manager
After an object is added, 
OJB seems to be holding on to objects in the cache after rollback
Sometimes I really wonder if iBatis or even JDBC would suite us better than this endless stream
of bugs

The really fucked up thing is that this works fine in my unit test
But in production, a commit sneaks in before the rollback
No idea where that one is coming from

Added:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java?rev=380297&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java
(added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/interceptors/PageManagerInterceptor.java
Thu Feb 23 17:52:12 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.interceptors;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.page.impl.DatabasePageManagerCache;
+
+/**
+ * Aspect that will attempt to rollback cache entries upon Page Manager failures
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ */
+public class PageManagerInterceptor implements MethodInterceptor
+{
+
+    /** Log reference */
+    private Log log = LogFactory.getLog(PageManagerInterceptor.class);
+
+    /** Serialization version identifier */
+    private static final long serialVersionUID = -1316279974504594833L;
+
+    /**
+     * Encloses <code>super.invoke()</code> in a try/catch block, where the
+     * catch block contains additional retry logic.
+     */
+    public Object invoke(MethodInvocation invocation) throws Throwable
+    {
+        try
+        {            
+            return invocation.proceed();
+        } 
+        catch (Exception exp)
+        {
+            DatabasePageManagerCache.rollbackTransactions();
+            throw exp;
+        }
+    }
+
+}



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