polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From soelvs...@apache.org
Subject zest-java git commit: try to fetch version from cached EntityState to align with previous caching behaviour
Date Sat, 05 Sep 2015 23:11:10 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop d212c550d -> 6dc286da4


try to fetch version from cached EntityState to align with previous caching behaviour


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/6dc286da
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/6dc286da
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/6dc286da

Branch: refs/heads/develop
Commit: 6dc286da4989c125b1a5601b9837833bb9b9ed62
Parents: d212c55
Author: Kent Sølvsten <soelvsten@apache.org>
Authored: Sun Sep 6 01:10:56 2015 +0200
Committer: Kent Sølvsten <soelvsten@apache.org>
Committed: Sun Sep 6 01:10:56 2015 +0200

----------------------------------------------------------------------
 .../spi/entitystore/DefaultEntityStoreUnitOfWork.java  |  5 +++++
 .../entitystore/helpers/JSONMapEntityStoreMixin.java   | 13 +++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/6dc286da/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
b/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
index a336af6..75a3387 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/DefaultEntityStoreUnitOfWork.java
@@ -97,6 +97,11 @@ public final class DefaultEntityStoreUnitOfWork
     public String versionOf( EntityReference anIdentity )
         throws EntityNotFoundException
     {
+        EntityState entityState = states.get( anIdentity );
+        if( entityState != null )
+        {
+            return entityState.version();
+        }
         return entityStoreSPI.versionOf( this, anIdentity );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/6dc286da/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
index e4a6e7b..fd8e3bc 100755
--- a/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
+++ b/core/spi/src/main/java/org/apache/zest/spi/entitystore/helpers/JSONMapEntityStoreMixin.java
@@ -200,6 +200,19 @@ public class JSONMapEntityStoreMixin
                                                    EntityReference identity
     )
     {
+        CacheState cacheState = cache.get( identity.identity() );
+        if( cacheState != null )
+        {
+            try
+            {
+                return cacheState.json.getString( JSONKeys.VERSION );
+            }
+            catch( JSONException e )
+            {
+                // Should not be able to happen, unless internal error in the cache system.
+                throw new EntityStoreException( e );
+            }
+        }
         // Get state
         Reader entityState = mapEntityStore.get( identity );
         try


Mime
View raw message