cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [08/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to 621156c
Date Sun, 28 Sep 2014 09:40:08 GMT
Revert "removed unused class"

This reverts commit 093fa6f0a53bd031a09e4042c3aa25860bc947e5.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2503aaaf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2503aaaf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2503aaaf

Branch: refs/heads/statscollector-graphite
Commit: 2503aaafef5280ce20e319c77623f9709d85151a
Parents: d8ad3e3
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Wed Sep 24 08:41:55 2014 +0200
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Wed Sep 24 08:41:55 2014 +0200

----------------------------------------------------------------------
 .../spring-core-system-context-inheritable.xml  |  5 +++
 .../utils/db/TransactionContextInterceptor.java | 40 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2503aaaf/core/resources/META-INF/cloudstack/system/spring-core-system-context-inheritable.xml
----------------------------------------------------------------------
diff --git a/core/resources/META-INF/cloudstack/system/spring-core-system-context-inheritable.xml
b/core/resources/META-INF/cloudstack/system/spring-core-system-context-inheritable.xml
index 6a1d0ea..2d454ac 100644
--- a/core/resources/META-INF/cloudstack/system/spring-core-system-context-inheritable.xml
+++ b/core/resources/META-INF/cloudstack/system/spring-core-system-context-inheritable.xml
@@ -40,8 +40,13 @@
   <!--
     AOP
   -->
+  <bean id="transactionContextInterceptor" class="com.cloud.utils.db.TransactionContextInterceptor"
/>
   <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" />
   <aop:config>
+    <aop:advisor advice-ref="transactionContextInterceptor" 
+        pointcut="target(com.cloud.utils.db.GenericDaoBase)" />
+    <aop:advisor advice-ref="transactionContextInterceptor" 
+        pointcut="execution(* com.cloud.utils.db.EntityManager.*(..))" />
     <aop:advisor advice-ref="actionEventInterceptor" 
         pointcut="execution(* *(..)) &amp;&amp; @annotation(com.cloud.event.ActionEvent)"
/>
     <aop:advisor advice-ref="actionEventInterceptor" 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2503aaaf/framework/db/src/com/cloud/utils/db/TransactionContextInterceptor.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionContextInterceptor.java b/framework/db/src/com/cloud/utils/db/TransactionContextInterceptor.java
new file mode 100644
index 0000000..bd747b1
--- /dev/null
+++ b/framework/db/src/com/cloud/utils/db/TransactionContextInterceptor.java
@@ -0,0 +1,40 @@
+/*
+ * 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 com.cloud.utils.db;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+
+public class TransactionContextInterceptor implements MethodInterceptor {
+
+    public TransactionContextInterceptor() {
+
+    }
+
+    @Override
+    public Object invoke(MethodInvocation m) throws Throwable {
+        TransactionLegacy txn = TransactionLegacy.open(m.getMethod().getName());
+        try {
+            return m.proceed();
+        } finally {
+            txn.close();
+        }
+    }
+
+}


Mime
View raw message