You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/02/26 17:27:29 UTC
[05/50] [abbrv] incubator-usergrid git commit: Fixes cache bug and
null emission issue
Fixes cache bug and null emission issue
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/13998493
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/13998493
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/13998493
Branch: refs/heads/two-dot-o
Commit: 139984935e8a9dce26025f390974ba7b574dfe36
Parents: d2a0ff2
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Feb 19 23:29:37 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Feb 19 23:29:37 2015 -0700
----------------------------------------------------------------------
.../cache/CachedEntityCollectionManager.java | 2 +-
.../collection/impl/EntityCollectionManagerImpl.java | 13 ++++++++-----
.../java/org/apache/usergrid/rest/IndexResource.java | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/13998493/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
index 5430759..186aafa 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
@@ -100,7 +100,7 @@ public class CachedEntityCollectionManager implements EntityCollectionManager {
return Observable.just( entity );
}
- return Observable.empty();
+ return targetEntityCollectionManager.load( entityId ).doOnNext( cacheAdd );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/13998493/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index 8c754c1..7c467c6 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -230,21 +230,24 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
Preconditions.checkNotNull( entityId.getUuid(), "Entity id uuid required in load stage" );
Preconditions.checkNotNull( entityId.getType(), "Entity id type required in load stage" );
- return load( Collections.singleton( entityId ) ).map( new Func1<EntitySet, Entity>() {
+ return load( Collections.singleton( entityId ) ).flatMap( new Func1<EntitySet, Observable<Entity>>() {
@Override
- public Entity call( final EntitySet entitySet ) {
+ public Observable<Entity> call( final EntitySet entitySet ) {
final MvccEntity entity = entitySet.getEntity( entityId );
- if ( entity == null ) {
- return null;
+ if ( entity == null || !entity.getEntity().isPresent() ) {
+ return Observable.empty();
}
- return entity.getEntity().orNull();
+ return Observable.from( entity.getEntity().get() );
}
} );
}
+
+
+
@Override
public Observable<EntitySet> load( final Collection<Id> entityIds ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/13998493/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
index acce2d8..7b391a1 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/IndexResource.java
@@ -142,7 +142,7 @@ public class IndexResource extends AbstractContextResource {
emf.rebuildApplicationIndexes( appId, po );
}
catch ( Exception e ) {
- logger.error( "Unable to re-index application" );
+ logger.error( "Unable to re-index application", e );
}
}
};