cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/4] cayenne git commit: Fix detection of NoopEventBridge (provider is actually a DefaultScopeProvider returning a NoopEventBridge)
Date Wed, 19 Dec 2018 07:45:01 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-4.0 cbeb58ab5 -> a07cd1c98


Fix detection of NoopEventBridge (provider is actually a DefaultScopeProvider returning a
NoopEventBridge)

(cherry picked from commit 220e1cb0189e2446214473959c8174c253eb6053)


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

Branch: refs/heads/STABLE-4.0
Commit: 377933370b40b6b3739d1e2613ecc3f64c9f5858
Parents: cbeb58a
Author: John Huss <johnthuss@apache.org>
Authored: Mon Dec 10 23:20:47 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Tue Dec 18 16:07:24 2018 +0300

----------------------------------------------------------------------
 .../cayenne/access/DefaultDataRowStoreFactory.java  | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/37793337/cayenne-server/src/main/java/org/apache/cayenne/access/DefaultDataRowStoreFactory.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/DefaultDataRowStoreFactory.java
b/cayenne-server/src/main/java/org/apache/cayenne/access/DefaultDataRowStoreFactory.java
index 4925a6d..68f6d1d 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DefaultDataRowStoreFactory.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DefaultDataRowStoreFactory.java
@@ -26,9 +26,7 @@ import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.di.Provider;
 import org.apache.cayenne.event.EventBridge;
 import org.apache.cayenne.event.EventManager;
-import org.apache.cayenne.event.NoopEventBridgeProvider;
-
-import java.util.Map;
+import org.apache.cayenne.event.NoopEventBridge;
 
 /**
  * A default implementation of {@link DataRowStoreFactory}
@@ -43,15 +41,12 @@ public class DefaultDataRowStoreFactory implements DataRowStoreFactory
{
 
     RuntimeProperties properties;
 
-    boolean isNoopEventBridge;
-
     public DefaultDataRowStoreFactory(@Inject Provider<EventBridge> eventBridgeProvider,
                                       @Inject EventManager eventManager,
                                       @Inject RuntimeProperties properties) {
         this.eventBridgeProvider = eventBridgeProvider;
         this.eventManager = eventManager;
         this.properties = properties;
-        isNoopEventBridge = eventBridgeProvider instanceof NoopEventBridgeProvider;
     }
 
     @Override
@@ -62,11 +57,12 @@ public class DefaultDataRowStoreFactory implements DataRowStoreFactory
{
     }
 
     private void setUpEventBridge(DataRowStore store) {
-        if(isNoopEventBridge) {
-            return;
-        }
         try {
-            store.setEventBridge(eventBridgeProvider.get());
+            EventBridge eventBridge = eventBridgeProvider.get();
+            if (eventBridge instanceof NoopEventBridge) {
+                return;
+            }
+            store.setEventBridge(eventBridge);
             store.startListeners();
         } catch (Exception ex) {
             throw new CayenneRuntimeException("Error initializing DataRowStore.", ex);


Mime
View raw message