usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [40/50] incubator-usergrid git commit: remove cache key for null
Date Mon, 13 Apr 2015 17:46:05 GMT
remove cache key for null


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

Branch: refs/heads/USERGRID-536
Commit: 60190766360c62d1a03405e0ab066b0f6c8202c6
Parents: 0fcdd27
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Wed Apr 8 16:31:35 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Wed Apr 8 16:31:35 2015 -0600

----------------------------------------------------------------------
 .../usergrid/corepersistence/ApplicationIdCacheImpl.java | 11 +++++++----
 .../migration/AppInfoMigrationPlugin.java                |  2 --
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60190766/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
index ec98e23..96066ae 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/ApplicationIdCacheImpl.java
@@ -73,7 +73,7 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {
             .build(new CacheLoader<String, Optional<UUID>>() {
                 @Override
                 public Optional<UUID> load(final String key) throws Exception {
-                    return fetchApplicationId(key);
+                    return Optional.of(fetchApplicationId(key));
                 }
             });
     }
@@ -82,6 +82,9 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {
     public UUID getApplicationId( final String applicationName ) {
         try {
             Optional<UUID> optionalUuid = appCache.get( applicationName.toLowerCase()
);
+            if(!optionalUuid.isPresent()){
+                appCache.invalidate(applicationName.toLowerCase());
+            }
             logger.debug("Returning for key {} value {}", applicationName, optionalUuid );
             return optionalUuid.get();
         } catch (Exception e) {
@@ -94,7 +97,7 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {
     /**
      * Fetch our application id
      */
-    private Optional<UUID> fetchApplicationId( final String applicationName ) {
+    private UUID fetchApplicationId( final String applicationName ) {
 
         UUID value = null;
 
@@ -104,7 +107,7 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {
 
         try {
             if ( managementEnityManager.getApplication() == null ) {
-                return Optional.empty();
+                return null;
             }
         } catch ( Exception e ) {
             logger.error("Error looking up management app", e);
@@ -123,7 +126,7 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {
             }else{
                 logger.debug("Could not load value for key {} ", applicationName );
             }
-            return value == null ? Optional.<UUID>empty() : Optional.of(value);
+            return value;
         }
         catch ( Exception e ) {
             throw new RuntimeException( "Unable to retrieve application id", e );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/60190766/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
index 92c8895..129f2f9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/migration/AppInfoMigrationPlugin.java
@@ -149,14 +149,12 @@ public class AppInfoMigrationPlugin implements MigrationPlugin {
             final String orgName = name.split("/")[0];
             final String appName = name.split("/")[1];
             UUID applicationId = getUuid(oldAppInfoMap,"applicationUuid");
-            UUID originalUuid = getUuid(oldAppInfoMap,"uuid");
 
             //get app info from graph to see if it has been migrated already
             Entity appInfo = getApplicationInfo(applicationId);
             if (appInfo == null) {
                 // create and connect new APPLICATION_INFO oldAppInfo to Organization
                 appInfo = createNewAppInfo(managementEm, name, applicationId);
-                deleteOldAppInfo(originalUuid);
                 observer.update(getMaxVersion(), "Created application_info for " + appName);
                 // create org->app connections, but not for apps in dummy "usergrid" internal
organization
                 if (!orgName.equals("usergrid")) {


Mime
View raw message