usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [48/50] usergrid git commit: fix default queue
Date Fri, 11 Sep 2015 01:28:19 GMT
fix default queue


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

Branch: refs/heads/USERGRID-909
Commit: 1c7ab04338e89fd1a7d1ebd15918be8875f933d7
Parents: 929528a
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Sep 10 17:06:39 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Sep 10 17:06:39 2015 -0600

----------------------------------------------------------------------
 .../queue/impl/QueueManagerFactoryImpl.java         | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/1c7ab043/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerFactoryImpl.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerFactoryImpl.java
index 2f9e7b1..d0ed1ef 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerFactoryImpl.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/QueueManagerFactoryImpl.java
@@ -25,6 +25,9 @@ import com.google.inject.Provider;
 import com.google.inject.Singleton;
 import org.apache.usergrid.persistence.queue.*;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * manages whether we take in an external in memory override for queues.
  */
@@ -34,14 +37,25 @@ public class QueueManagerFactoryImpl implements QueueManagerFactory {
 
     private final QueueFig queueFig;
     private final QueueManagerInternalFactory queuemanagerInternalFactory;
+    private final Map<String,QueueManager> defaultManager;
 
     @Inject
     public QueueManagerFactoryImpl(final QueueFig queueFig, final QueueManagerInternalFactory
queuemanagerInternalFactory){
         this.queueFig = queueFig;
         this.queuemanagerInternalFactory = queuemanagerInternalFactory;
+        this.defaultManager = new HashMap<>(10);
     }
     @Override
     public QueueManager getQueueManager(QueueScope scope) {
-        return queueFig.overrideQueueForDefault() ? new DefaultQueueManager() : queuemanagerInternalFactory.getQueueManager(scope);
+        if(queueFig.overrideQueueForDefault()){
+            QueueManager manager = defaultManager.get(scope.getName());
+            if(manager==null){
+                manager = new DefaultQueueManager();
+                defaultManager.put(scope.getName(),manager);
+            }
+            return manager;
+        }else{
+            return queuemanagerInternalFactory.getQueueManager(scope);
+        }
     }
 }


Mime
View raw message