cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnth...@apache.org
Subject [5/5] cayenne git commit: Fix detection of NoopEventBridge (provider is actually a DefaultScopeProvider returning a NoopEventBridge)
Date Wed, 12 Dec 2018 20:49:25 GMT
Fix detection of NoopEventBridge (provider is actually a DefaultScopeProvider returning a NoopEventBridge)


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

Branch: refs/heads/master
Commit: 220e1cb0189e2446214473959c8174c253eb6053
Parents: c8557ff
Author: John Huss <johnthuss@apache.org>
Authored: Mon Dec 10 14:20:47 2018 -0600
Committer: John Huss <johnthuss@apache.org>
Committed: Wed Dec 12 14:48:55 2018 -0600

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


http://git-wip-us.apache.org/repos/asf/cayenne/blob/220e1cb0/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