You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2017/03/07 05:29:55 UTC

svn commit: r1785796 - /aries/trunk/jpa/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java

Author: cschneider
Date: Tue Mar  7 05:29:55 2017
New Revision: 1785796

URL: http://svn.apache.org/viewvc?rev=1785796&view=rev
Log:
Revert "[ARIES-1689] Fix initialization"

This was broken. Reverting to Guiseppes solution.

Modified:
    aries/trunk/jpa/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java

Modified: aries/trunk/jpa/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java?rev=1785796&r1=1785795&r2=1785796&view=diff
==============================================================================
--- aries/trunk/jpa/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java (original)
+++ aries/trunk/jpa/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java Tue Mar  7 05:29:55 2017
@@ -19,7 +19,6 @@
 package org.apache.aries.jpa.blueprint.impl;
 
 import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.persistence.EntityManager;
 import javax.persistence.spi.PersistenceUnitTransactionType;
@@ -40,13 +39,11 @@ public class JpaInterceptor implements I
     private BlueprintContainer container;
     private String coordinatorId;
     private String emId;
-    private AtomicBoolean initialized;
 
     public JpaInterceptor(BlueprintContainer container, String coordinatorId, String emId) {
         this.container = container;
         this.coordinatorId = coordinatorId;
         this.emId = emId;
-        this.initialized = new AtomicBoolean(false);
     }
 
     @Override
@@ -56,7 +53,7 @@ public class JpaInterceptor implements I
 
     @Override
     public Object preCall(ComponentMetadata cm, Method m, Object... parameters) throws Throwable {
-        if (!initialized.get()) {
+        if (coordinator == null || em == null) {
             initServices();
         }
         try {
@@ -74,7 +71,7 @@ public class JpaInterceptor implements I
     }
 
     private synchronized void initServices() {
-        if (initialized.compareAndSet(false, true)) {
+        if (coordinator == null || em == null) {
             coordinator = (Coordinator)container.getComponentInstance(coordinatorId);
             em = (EntityManager)container.getComponentInstance(emId);
         }