usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [23/50] usergrid git commit: remove excess interfaces
Date Wed, 21 Oct 2015 20:12:34 GMT
remove excess interfaces


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

Branch: refs/heads/jacoco
Commit: efffe474bdca1223222f955204301f604dea40b8
Parents: e5e9d02
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Mon Oct 19 11:38:25 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Mon Oct 19 11:38:25 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        |  7 +-
 .../corepersistence/CpEntityManagerFactory.java |  3 +-
 .../asyncevents/AsyncIndexProvider.java         |  7 +-
 .../usergrid/persistence/EntityManager.java     |  5 +-
 .../persistence/EntityManagerFactory.java       |  4 +-
 .../corepersistence/StaleIndexCleanupTest.java  |  5 +-
 .../persistence/query/IteratingQueryIT.java     |  1 +
 .../usergrid/persistence/index/EntityIndex.java | 20 +++-
 .../persistence/index/IndexRefreshCommand.java  | 50 ----------
 .../persistence/index/guice/IndexModule.java    |  1 -
 .../index/impl/EsEntityIndexFactoryImpl.java    |  6 +-
 .../index/impl/EsEntityIndexImpl.java           | 38 ++++++--
 .../index/impl/IndexRefreshCommandImpl.java     | 97 -------------------
 .../persistence/index/impl/EntityIndexTest.java |  2 +-
 .../persistence/queue/DefaultQueueManager.java  | 98 --------------------
 .../persistence/queue/LocalQueueManager.java    | 98 ++++++++++++++++++++
 .../queue/impl/QueueManagerFactoryImpl.java     |  4 +-
 .../apns/NotificationsServiceIT.java            |  4 +-
 .../gcm/NotificationsServiceIT.java             |  2 -
 19 files changed, 170 insertions(+), 282 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index addd6ef..4b32389 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -40,7 +40,6 @@ import org.apache.usergrid.corepersistence.service.CollectionService;
 import org.apache.usergrid.corepersistence.service.ConnectionService;
 import org.apache.usergrid.persistence.index.EntityIndex;
 import org.apache.usergrid.persistence.index.IndexLocationStrategy;
-import org.apache.usergrid.persistence.index.IndexRefreshCommand;
 import org.apache.usergrid.persistence.index.utils.*;
 import org.apache.usergrid.utils.*;
 import org.apache.usergrid.utils.ClassUtils;
@@ -2877,7 +2876,7 @@ public class CpEntityManager implements EntityManager {
     /**
      * TODO, these 3 methods are super janky.  During refactoring we should clean this model
up
      */
-    public IndexRefreshCommand.IndexRefreshCommandInfo refreshIndex() {
+    public EntityIndex.IndexRefreshCommandInfo refreshIndex() {
         try {
             long start = System.currentTimeMillis();
             // refresh special indexes without calling EntityManager refresh because stack
overflow
@@ -2885,7 +2884,7 @@ public class CpEntityManager implements EntityManager {
             map.put("some prop", "test");
             boolean hasFinished = false;
             Entity refreshEntity = create("refresh", map);
-            IndexRefreshCommand.IndexRefreshCommandInfo indexRefreshCommandInfo
+            EntityIndex.IndexRefreshCommandInfo indexRefreshCommandInfo
                 = managerCache.getEntityIndex(applicationScope).refreshAsync().toBlocking().first();
             try {
                 for (int i = 0; i < 10; i++) {
@@ -2899,6 +2898,7 @@ public class CpEntityManager implements EntityManager {
                         break;
                     }
                     Thread.sleep(200);
+
                     indexRefreshCommandInfo
                         = managerCache.getEntityIndex(applicationScope).refreshAsync().toBlocking().first();
                 }
@@ -2908,6 +2908,7 @@ public class CpEntityManager implements EntityManager {
             }finally {
                 delete(refreshEntity);
             }
+            Thread.sleep(200);
 
             return indexRefreshCommandInfo;
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 4bdade5..8d890e6 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -66,7 +66,6 @@ import org.apache.usergrid.persistence.graph.GraphManagerFactory;
 import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
 import org.apache.usergrid.persistence.index.EntityIndex;
-import org.apache.usergrid.persistence.index.IndexRefreshCommand;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -689,7 +688,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
     /**
      * TODO, these 3 methods are super janky.  During refactoring we should clean this model
up
      */
-    public IndexRefreshCommand.IndexRefreshCommandInfo refreshIndex(UUID applicationId) {
+    public EntityIndex.IndexRefreshCommandInfo refreshIndex(UUID applicationId) {
         return getEntityManager(applicationId).refreshIndex();
     }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
index 0677aaf..f5197d2 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AsyncIndexProvider.java
@@ -22,20 +22,17 @@ package org.apache.usergrid.corepersistence.asyncevents;
 
 import org.apache.usergrid.corepersistence.index.IndexLocationStrategyFactory;
 import org.apache.usergrid.corepersistence.index.IndexProcessorFig;
-import org.apache.usergrid.corepersistence.index.IndexService;
 import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
 import org.apache.usergrid.persistence.core.rx.RxTaskScheduler;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.index.EntityIndexFactory;
 import org.apache.usergrid.persistence.index.impl.IndexProducer;
-import org.apache.usergrid.persistence.queue.DefaultQueueManager;
-import org.apache.usergrid.persistence.queue.QueueManager;
+import org.apache.usergrid.persistence.queue.LocalQueueManager;
 import org.apache.usergrid.persistence.queue.QueueManagerFactory;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
-import org.apache.usergrid.persistence.queue.QueueScope;
 
 
 /**
@@ -99,7 +96,7 @@ public class AsyncIndexProvider implements Provider<AsyncEventService>
{
 
         switch (impl) {
             case LOCAL:
-                AmazonAsyncEventService eventService = new AmazonAsyncEventService(scope
-> new DefaultQueueManager(), indexProcessorFig, indexProducer, metricsFactory,
+                AmazonAsyncEventService eventService = new AmazonAsyncEventService(scope
-> new LocalQueueManager(), indexProcessorFig, indexProducer, metricsFactory,
                     entityCollectionManagerFactory, indexLocationStrategyFactory, entityIndexFactory,
eventBuilder, rxTaskScheduler);
                 eventService.MAX_TAKE = 1000;
                 return eventService;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
index 9c4a929..20e8d23 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
@@ -29,7 +29,7 @@ import org.apache.usergrid.persistence.Query.Level;
 import org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.Role;
-import org.apache.usergrid.persistence.index.IndexRefreshCommand;
+import org.apache.usergrid.persistence.index.EntityIndex;
 import org.apache.usergrid.persistence.index.query.CounterResolution;
 import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -734,6 +734,5 @@ public interface EntityManager {
      * init the index
      */
     void initializeIndex();
-
-    IndexRefreshCommand.IndexRefreshCommandInfo refreshIndex();
+    EntityIndex.IndexRefreshCommandInfo refreshIndex();
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
index bde1bd2..cb44d4d 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
@@ -25,7 +25,7 @@ import com.google.common.base.Optional;
 
 import org.apache.usergrid.corepersistence.index.ReIndexService;
 import org.apache.usergrid.persistence.core.util.Health;
-import org.apache.usergrid.persistence.index.IndexRefreshCommand;
+import org.apache.usergrid.persistence.index.EntityIndex;
 import rx.Observable;
 
 
@@ -166,7 +166,7 @@ public interface EntityManagerFactory {
 
     public UUID getManagementAppId();
 
-    public IndexRefreshCommand.IndexRefreshCommandInfo refreshIndex(UUID applicationId);
+    public EntityIndex.IndexRefreshCommandInfo refreshIndex(UUID applicationId);
 
     /**
      * Perform a realtime count of every entity in the system.  This can be slow as it traverses
the entire system graph

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
index 16d9a5b..5e0e062 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
@@ -364,10 +364,13 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
 
         // query Core Persistence directly for total number of result candidates
         for(int i = 0;i<10;i++){
+
+            crs = queryCollectionCp("things", "thing", "select *");
             if(numEntities * (numUpdates + 1) == crs.size()){
                 break;
+            }else{
+                Thread.sleep(1100);
             }
-            crs = queryCollectionCp("things", "thing", "select *");
         }
 
 //        Assert.assertEquals("Expect stale candidates", numEntities * (numUpdates + 1),
crs.size());

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
index e589be4..3ff48b6 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java
@@ -926,6 +926,7 @@ public class IteratingQueryIT {
         }
         app.refreshIndex();
 
+        Thread.sleep(500);
         long stop = System.currentTimeMillis();
 
         LOG.info( "Writes took {} ms", stop - start );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index 72300a5..81f900c 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@ -55,7 +55,7 @@ public interface EntityIndex extends CPManager {
     /**
      * Refresh the index.
      */
-    Observable<IndexRefreshCommand.IndexRefreshCommandInfo> refreshAsync();
+    Observable<IndexRefreshCommandInfo> refreshAsync();
 
 
     /**
@@ -71,6 +71,7 @@ public interface EntityIndex extends CPManager {
 
     /**
      * get total entity size by an edge ->   "term":{"edgeName":"zzzcollzzz|roles"}
+     *
      * @param edge
      * @return
      */
@@ -149,6 +150,23 @@ public interface EntityIndex extends CPManager {
     enum AliasType {
         Read, Write
     }
+    class IndexRefreshCommandInfo{
+        private final boolean hasFinished;
+        private final long executionTime;
+
+        public IndexRefreshCommandInfo(boolean hasFinished, long executionTime){
+            this.hasFinished = hasFinished;
+            this.executionTime = executionTime;
+        }
+
+        public boolean hasFinished() {
+            return hasFinished;
+        }
+
+        public long getExecutionTime() {
+            return executionTime;
+        }
+    }
 
 }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexRefreshCommand.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexRefreshCommand.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexRefreshCommand.java
deleted file mode 100644
index 2226d89..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexRefreshCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.  For additional information regarding
- * copyright in this work, please see the NOTICE file in the top level
- * directory of this distribution.
- *
- */
-package org.apache.usergrid.persistence.index;
-
-import rx.Observable;
-
-/**
- * Classy class class.
- */
-public interface IndexRefreshCommand {
-
-    Observable<IndexRefreshCommandInfo> execute(IndexAlias alias, String[] indexes);
-
-    class IndexRefreshCommandInfo{
-        private final boolean hasFinished;
-        private final long executionTime;
-
-        public IndexRefreshCommandInfo(boolean hasFinished, long executionTime){
-            this.hasFinished = hasFinished;
-            this.executionTime = executionTime;
-        }
-
-        public boolean hasFinished() {
-            return hasFinished;
-        }
-
-        public long getExecutionTime() {
-            return executionTime;
-        }
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
index 46559ad..b828934 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
@@ -50,7 +50,6 @@ public abstract class IndexModule extends AbstractModule {
 
         bind( EntityIndexFactory.class ).to( EsEntityIndexFactoryImpl.class );
         bind(IndexCache.class).to(EsIndexCacheImpl.class);
-        bind(IndexRefreshCommand.class).to(IndexRefreshCommandImpl.class);
 
         bind(IndexProducer.class).to(EsIndexProducerImpl.class).asEagerSingleton();
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
index c91057b..f4e89ad 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexFactoryImpl.java
@@ -38,7 +38,6 @@ public class EsEntityIndexFactoryImpl implements EntityIndexFactory{
     private final IndexCache indexCache;
     private final EsProvider provider;
     private final MetricsFactory metricsFactory;
-    private final IndexRefreshCommand refreshCommand;
 
     private LoadingCache<IndexLocationStrategy, EntityIndex> eiCache =
         CacheBuilder.newBuilder().maximumSize( 1000 ).build( new CacheLoader<IndexLocationStrategy,
EntityIndex>() {
@@ -47,7 +46,6 @@ public class EsEntityIndexFactoryImpl implements EntityIndexFactory{
                     provider,
                     indexCache,
                     config,
-                    refreshCommand,
                     metricsFactory,
                     locationStrategy
                 );
@@ -60,15 +58,13 @@ public class EsEntityIndexFactoryImpl implements EntityIndexFactory{
     public EsEntityIndexFactoryImpl( final IndexFig indexFig,
                                      final IndexCache indexCache,
                                      final EsProvider provider,
-                                     final MetricsFactory metricsFactory,
-                                     final IndexRefreshCommand refreshCommand
+                                     final MetricsFactory metricsFactory
 
     ){
         this.config = indexFig;
         this.indexCache = indexCache;
         this.provider = provider;
         this.metricsFactory = metricsFactory;
-        this.refreshCommand = refreshCommand;
     }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index f6ebce2..5f2a547 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -31,6 +31,7 @@ import org.apache.usergrid.persistence.core.metrics.ObservableTimer;
 import org.apache.usergrid.persistence.core.migration.data.VersionedData;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.Health;
+import org.apache.usergrid.persistence.core.util.StringUtils;
 import org.apache.usergrid.persistence.core.util.ValidationUtils;
 import org.apache.usergrid.persistence.index.*;
 import org.apache.usergrid.persistence.index.ElasticSearchQueryBuilder.SearchRequestBuilderStrategyV2;
@@ -50,6 +51,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
 import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
 import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
 import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
+import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
 import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
 import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse;
 import org.elasticsearch.action.search.SearchRequestBuilder;
@@ -98,7 +100,6 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
      * We purposefully make this per instance. Some indexes may work, while others may fail
      */
     private final EsProvider esProvider;
-    private final IndexRefreshCommand indexRefreshCommand;
 
     //number of times to wait for the index to refresh properly.
     private static final int MAX_WAITS = 10;
@@ -118,6 +119,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
     private final long queryTimeout;
     private final FailureMonitorImpl failureMonitor;
     private final Timer aggregationTimer;
+    private final Timer refreshTimer;
 
     private IndexCache aliasCache;
     private Timer mappingTimer;
@@ -128,7 +130,6 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
     public EsEntityIndexImpl( final EsProvider provider,
                               final IndexCache indexCache,
                               final IndexFig indexFig,
-                              final IndexRefreshCommand indexRefreshCommand,
                               final MetricsFactory metricsFactory,
                               final IndexLocationStrategy indexLocationStrategy
     ) {
@@ -137,7 +138,6 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
         this.indexLocationStrategy = indexLocationStrategy;
         this.failureMonitor = new FailureMonitorImpl( indexFig, provider );
         this.esProvider = provider;
-        this.indexRefreshCommand = indexRefreshCommand;
         this.alias = indexLocationStrategy.getAlias();
         this.aliasCache = indexCache;
         this.applicationScope = indexLocationStrategy.getApplicationScope();
@@ -153,6 +153,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
         this.refreshIndexMeter = metricsFactory.getMeter(EsEntityIndexImpl.class, "index.refresh_index");
         this.searchTimer = metricsFactory.getTimer(EsEntityIndexImpl.class, "search");
         this.aggregationTimer = metricsFactory.getTimer( EsEntityIndexImpl.class, "aggregations"
);
+        this.refreshTimer = metricsFactory.getTimer( EsEntityIndexImpl.class, "index.refresh"
);
 
     }
 
@@ -350,11 +351,34 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData
{
 
 
 
-
-    public Observable<IndexRefreshCommand.IndexRefreshCommandInfo> refreshAsync() {
+    public Observable<IndexRefreshCommandInfo> refreshAsync() {
 
         refreshIndexMeter.mark();
-        return indexRefreshCommand.execute(alias, getIndexes());
+        final long start = System.currentTimeMillis();
+
+        String[] indexes = getIndexes();
+        if (indexes.length == 0) {
+            logger.debug("Not refreshing indexes. none found");
+        }
+        //Added For Graphite Metrics
+        RefreshResponse response =
+            esProvider.getClient().admin().indices().prepareRefresh(indexes).execute().actionGet();
+        int failedShards = response.getFailedShards();
+        int successfulShards = response.getSuccessfulShards();
+        ShardOperationFailedException[] sfes = response.getShardFailures();
+        if (sfes != null) {
+            for (ShardOperationFailedException sfe : sfes) {
+                logger.error("Failed to refresh index:{} reason:{}", sfe.index(), sfe.reason());
+            }
+        }
+        logger.debug("Refreshed indexes: {},success:{} failed:{} ", StringUtils.join(indexes,
", "),
+            successfulShards, failedShards);
+
+        IndexRefreshCommandInfo refreshResults = new IndexRefreshCommandInfo(failedShards
== 0,
+            System.currentTimeMillis() - start);
+
+
+        return ObservableTimer.time(Observable.just(refreshResults), refreshTimer);
     }
 
 
@@ -782,4 +806,6 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
     }
 
 
+
+
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
deleted file mode 100644
index bd67fb6..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  The ASF licenses this file to You
- * under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.  For additional information regarding
- * copyright in this work, please see the NOTICE file in the top level
- * directory of this distribution.
- *
- */
-package org.apache.usergrid.persistence.index.impl;
-
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.usergrid.persistence.index.*;
-import org.elasticsearch.action.ShardOperationFailedException;
-import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
-import org.elasticsearch.action.search.SearchRequestBuilder;
-import org.elasticsearch.index.query.FilterBuilders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
-import org.apache.usergrid.persistence.core.metrics.ObservableTimer;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
-import org.apache.usergrid.persistence.core.util.StringUtils;
-import org.apache.usergrid.persistence.index.utils.UUIDUtils;
-import org.apache.usergrid.persistence.model.entity.Entity;
-import org.apache.usergrid.persistence.model.entity.Id;
-import org.apache.usergrid.persistence.model.entity.SimpleId;
-import org.apache.usergrid.persistence.model.util.EntityUtils;
-import org.apache.usergrid.persistence.model.util.UUIDGenerator;
-
-import com.codahale.metrics.Timer;
-import com.google.inject.Inject;
-
-import rx.Observable;
-
-
-/**
- * Classy class class.
- */
-public class IndexRefreshCommandImpl implements IndexRefreshCommand {
-    private static final Logger logger = LoggerFactory.getLogger( IndexRefreshCommandImpl.class
);
-
-    private final EsProvider esProvider;
-    private final Timer timer;
-
-
-    @Inject
-    public IndexRefreshCommandImpl( final EsProvider esProvider,final MetricsFactory metricsFactory)
{
-
-        this.timer = metricsFactory.getTimer( IndexRefreshCommandImpl.class, "index.refresh"
);
-        this.esProvider = esProvider;
-    }
-
-
-    @Override
-    public Observable<IndexRefreshCommandInfo> execute(IndexAlias alias, String[] indexes
) {
-
-        final long start = System.currentTimeMillis();
-
-        if (indexes.length == 0) {
-            logger.debug("Not refreshing indexes. none found");
-        }
-        //Added For Graphite Metrics
-        RefreshResponse response =
-            esProvider.getClient().admin().indices().prepareRefresh(indexes).execute().actionGet();
-        int failedShards = response.getFailedShards();
-        int successfulShards = response.getSuccessfulShards();
-        ShardOperationFailedException[] sfes = response.getShardFailures();
-        if (sfes != null) {
-            for (ShardOperationFailedException sfe : sfes) {
-                logger.error("Failed to refresh index:{} reason:{}", sfe.index(), sfe.reason());
-            }
-        }
-        logger.debug("Refreshed indexes: {},success:{} failed:{} ", StringUtils.join(indexes,
", "),
-            successfulShards, failedShards);
-
-        IndexRefreshCommandInfo refreshResults = new IndexRefreshCommandInfo(failedShards
== 0,
-            System.currentTimeMillis() - start);
-
-        return ObservableTimer.time(Observable.just(refreshResults), timer);
-    }
-}

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 3a91f12..8b51748 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@ -310,7 +310,7 @@ public class EntityIndexTest extends BaseIT {
         EntityIndexBatch batch = entityIndex.createBatch();
         insertJsonBlob(sampleJson, batch, entityType, indexEdge, max, startIndex);
         indexProducer.put(batch.build()).subscribe();;
-        IndexRefreshCommandImpl.IndexRefreshCommandInfo info =  entityIndex.refreshAsync().toBlocking().first();
+        EntityIndex.IndexRefreshCommandInfo info =  entityIndex.refreshAsync().toBlocking().first();
         long time = info.getExecutionTime();
         log.info("refresh took ms:" + time);
     }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
deleted file mode 100644
index 08f17a0..0000000
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/DefaultQueueManager.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *
- *  * Licensed to the Apache Software Foundation (ASF) under one or more
- *  *  contributor license agreements.  The ASF licenses this file to You
- *  * under the Apache License, Version 2.0 (the "License"); you may not
- *  * use this file except in compliance with the License.
- *  * You may obtain a copy of the License at
- *  *
- *  *     http://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.  For additional information regarding
- *  * copyright in this work, please see the NOTICE file in the top level
- *  * directory of this distribution.
- *
- */
-
-package org.apache.usergrid.persistence.queue;
-
-import rx.Observable;
-
-import java.io.IOException;
-import java.util.AbstractQueue;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.PriorityBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Default queue manager implementation, uses in memory linked queue
- */
-public class DefaultQueueManager implements QueueManager {
-    public ArrayBlockingQueue<QueueMessage> queue = new ArrayBlockingQueue<>(10000);
-
-    @Override
-    public    Observable<QueueMessage> getMessages(int limit, int transactionTimeout,
int waitTime, Class klass) {
-        List<QueueMessage> returnQueue = new ArrayList<>();
-        try {
-            QueueMessage message=null;
-            int count = 5;
-            do {
-                message = queue.poll(100, TimeUnit.MILLISECONDS);
-                if (message != null) {
-                    returnQueue.add(message);
-                }
-            }while(message!=null && count-->0);
-        }catch (InterruptedException ie){
-            throw new RuntimeException(ie);
-        }
-        return Observable.from( returnQueue);
-    }
-
-    @Override
-    public long getQueueDepth() {
-        return queue.size();
-    }
-
-    @Override
-    public void commitMessage(QueueMessage queueMessage) {
-    }
-
-    @Override
-    public void commitMessages(List<QueueMessage> queueMessages) {
-    }
-
-    @Override
-    public  void sendMessages(List bodies) throws IOException {
-        for(Object body : bodies){
-            String uuid = UUID.randomUUID().toString();
-            try {
-                queue.put(new QueueMessage(uuid, "handle_" + uuid, body, "put type here"));
-            }catch (InterruptedException ie){
-                throw new RuntimeException(ie);
-            }
-        }
-    }
-
-    @Override
-    public  void sendMessage(Object body) throws IOException {
-        String uuid = UUID.randomUUID().toString();
-        try {
-            queue.put(new QueueMessage(uuid, "handle_" + uuid, body, "put type here"));
-        }catch (InterruptedException ie){
-            throw new RuntimeException(ie);
-        }
-    }
-
-    @Override
-    public void deleteQueue() {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/LocalQueueManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/LocalQueueManager.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/LocalQueueManager.java
new file mode 100644
index 0000000..4b4218a
--- /dev/null
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/LocalQueueManager.java
@@ -0,0 +1,98 @@
+/*
+ *
+ *  * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  *  contributor license agreements.  The ASF licenses this file to You
+ *  * under the Apache License, Version 2.0 (the "License"); you may not
+ *  * use this file except in compliance with the License.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *     http://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.  For additional information regarding
+ *  * copyright in this work, please see the NOTICE file in the top level
+ *  * directory of this distribution.
+ *
+ */
+
+package org.apache.usergrid.persistence.queue;
+
+import rx.Observable;
+
+import java.io.IOException;
+import java.util.AbstractQueue;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.PriorityBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Default queue manager implementation, uses in memory linked queue
+ */
+public class LocalQueueManager implements QueueManager {
+    public ArrayBlockingQueue<QueueMessage> queue = new ArrayBlockingQueue<>(10000);
+
+    @Override
+    public    Observable<QueueMessage> getMessages(int limit, int transactionTimeout,
int waitTime, Class klass) {
+        List<QueueMessage> returnQueue = new ArrayList<>();
+        try {
+            QueueMessage message=null;
+            int count = 5;
+            do {
+                message = queue.poll(100, TimeUnit.MILLISECONDS);
+                if (message != null) {
+                    returnQueue.add(message);
+                }
+            }while(message!=null && count-->0);
+        }catch (InterruptedException ie){
+            throw new RuntimeException(ie);
+        }
+        return Observable.from( returnQueue);
+    }
+
+    @Override
+    public long getQueueDepth() {
+        return queue.size();
+    }
+
+    @Override
+    public void commitMessage(QueueMessage queueMessage) {
+    }
+
+    @Override
+    public void commitMessages(List<QueueMessage> queueMessages) {
+    }
+
+    @Override
+    public  void sendMessages(List bodies) throws IOException {
+        for(Object body : bodies){
+            String uuid = UUID.randomUUID().toString();
+            try {
+                queue.put(new QueueMessage(uuid, "handle_" + uuid, body, "put type here"));
+            }catch (InterruptedException ie){
+                throw new RuntimeException(ie);
+            }
+        }
+    }
+
+    @Override
+    public  void sendMessage(Object body) throws IOException {
+        String uuid = UUID.randomUUID().toString();
+        try {
+            queue.put(new QueueMessage(uuid, "handle_" + uuid, body, "put type here"));
+        }catch (InterruptedException ie){
+            throw new RuntimeException(ie);
+        }
+    }
+
+    @Override
+    public void deleteQueue() {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/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 d0ed1ef..0f78678 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
@@ -19,9 +19,7 @@
  */
 package org.apache.usergrid.persistence.queue.impl;
 
-import com.google.inject.Guice;
 import com.google.inject.Inject;
-import com.google.inject.Provider;
 import com.google.inject.Singleton;
 import org.apache.usergrid.persistence.queue.*;
 
@@ -50,7 +48,7 @@ public class QueueManagerFactoryImpl implements QueueManagerFactory {
         if(queueFig.overrideQueueForDefault()){
             QueueManager manager = defaultManager.get(scope.getName());
             if(manager==null){
-                manager = new DefaultQueueManager();
+                manager = new LocalQueueManager();
                 defaultManager.put(scope.getName(),manager);
             }
             return manager;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 9c1bcbe..8b94661 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -21,7 +21,7 @@ import org.apache.commons.io.IOUtils;
 import org.apache.usergrid.persistence.*;
 import org.apache.usergrid.persistence.entities.*;
 import org.apache.usergrid.persistence.Query;
-import org.apache.usergrid.persistence.queue.DefaultQueueManager;
+import org.apache.usergrid.persistence.queue.LocalQueueManager;
 import org.apache.usergrid.services.notifications.*;
 import org.junit.*;
 import org.slf4j.Logger;
@@ -119,7 +119,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT
{
 
         ns = getNotificationService();
 
-        DefaultQueueManager qm = new DefaultQueueManager();
+        LocalQueueManager qm = new LocalQueueManager();
 
                 setup.getEntityIndex().refresh(app.getId());
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/efffe474/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 96653a5..3218137 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -18,10 +18,8 @@ package org.apache.usergrid.services.notifications.gcm;
 
 import org.apache.usergrid.persistence.*;
 import org.apache.usergrid.persistence.entities.*;
-import org.apache.usergrid.persistence.queue.DefaultQueueManager;
 import org.apache.usergrid.services.notifications.*;
 import org.junit.*;
-import org.junit.rules.TestName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 


Mime
View raw message