aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1628506 - in /aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context: impl/ManagedPersistenceContextFactory.java transaction/impl/JTAEntityManagerClose.java transaction/impl/JTAEntityManagerHandler.java
Date Tue, 30 Sep 2014 18:08:57 GMT
Author: cschneider
Date: Tue Sep 30 18:08:57 2014
New Revision: 1628506

URL: http://svn.apache.org/r1628506
Log:
ARIES-1251 Fixes for Synchronization and Close support

Added:
    aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerClose.java
Modified:
    aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java
    aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java

Modified: aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java?rev=1628506&r1=1628505&r2=1628506&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java
(original)
+++ aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/impl/ManagedPersistenceContextFactory.java
Tue Sep 30 18:08:57 2014
@@ -38,6 +38,7 @@ import javax.persistence.metamodel.Metam
 import org.apache.aries.jpa.container.context.PersistenceContextProvider;
 import org.apache.aries.jpa.container.context.impl.PersistenceContextManager.QuiesceTidyUp;
 import org.apache.aries.jpa.container.context.transaction.impl.DestroyCallback;
+import org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManagerClose;
 import org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManagerHandler;
 import org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry;
 import org.apache.aries.jpa.container.sync.Synchronization;
@@ -89,7 +90,7 @@ public class ManagedPersistenceContextFa
                 });
         JTAEntityManagerHandler invocationHandler = new JTAEntityManagerHandler(factory,
properties, registry, activeCount, this);
         ClassLoader cl = this.getClass().getClassLoader();
-        Class<?>[] ifAr = new Class[] { Synchronization.class, EntityManager.class
}; 
+        Class<?>[] ifAr = new Class[] { Synchronization.class, EntityManager.class,
JTAEntityManagerClose.class }; 
         em = (EntityManager)Proxy.newProxyInstance(cl, ifAr, invocationHandler);
     }
     

Added: aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerClose.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerClose.java?rev=1628506&view=auto
==============================================================================
--- aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerClose.java
(added)
+++ aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerClose.java
Tue Sep 30 18:08:57 2014
@@ -0,0 +1,8 @@
+package org.apache.aries.jpa.container.context.transaction.impl;
+
+/**
+ * Close all JTAEntityManager instances on blueprint shutdown
+ */
+public interface JTAEntityManagerClose {
+    void internalClose();
+}

Modified: aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java?rev=1628506&r1=1628505&r2=1628506&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
(original)
+++ aries/trunk/jpa/jpa-container-context/src/main/java/org/apache/aries/jpa/container/context/transaction/impl/JTAEntityManagerHandler.java
Tue Sep 30 18:08:57 2014
@@ -135,7 +135,6 @@ public class JTAEntityManagerHandler imp
         }
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
         if ("close".equals(method.getName())) {
@@ -152,8 +151,24 @@ public class JTAEntityManagerHandler imp
             return null;
         }
         
+        if ("postCall".equals(method.getName())) {
+            postCall();
+            return null;
+        }
+        
+        if ("preCall".equals(method.getName())) {
+            preCall();
+            return null;
+        }
+        
+        if ("internalClose".equals(method.getName())) {
+            internalClose();
+            return null;
+        }
+        
         boolean forceTransaction = transactedMethods.contains(method.getName());
         
+        // TODO Check if this can be reached
         if ("joinTransaction".equals(method.getName())) {
             forceTransaction = args[2] != LockModeType.NONE;
         }



Mime
View raw message