You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ja...@apache.org on 2017/08/17 22:23:45 UTC

[4/4] geode git commit: updated

updated


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

Branch: refs/heads/feature/GEODE-3434
Commit: d282ec4470a3993f7b401675bf7eb4161e1fb66e
Parents: be30589
Author: Jason Huynh <hu...@gmail.com>
Authored: Thu Aug 17 15:04:42 2017 -0700
Committer: Jason Huynh <hu...@gmail.com>
Committed: Thu Aug 17 15:04:51 2017 -0700

----------------------------------------------------------------------
 .../modules/session/catalina/DeltaSession.java  | 34 +++++++++++---------
 geode-old-versions/build.gradle                 | 14 ++++----
 2 files changed, 26 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/d282ec44/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
----------------------------------------------------------------------
diff --git a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
index 2b1cf3d..669f68a 100644
--- a/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
+++ b/extensions/geode-modules/src/main/java/org/apache/geode/modules/session/catalina/DeltaSession.java
@@ -50,8 +50,8 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 
 @SuppressWarnings("serial")
 public class DeltaSession extends StandardSession
@@ -82,6 +82,8 @@ public class DeltaSession extends StandardSession
 
   private byte[] serializedPrincipal;
 
+  private Field cachedField = null;
+
   private final Log LOG = LogFactory.getLog(DeltaSession.class.getName());
 
   /**
@@ -556,22 +558,25 @@ public class DeltaSession extends StandardSession
   }
 
   private void readInAttributes(DataInput in) throws IOException, ClassNotFoundException {
-    Map map = DataSerializer.readObject(in);
-    ConcurrentMap newMap = new ConcurrentHashMap();
-    newMap.putAll(map);
+    ConcurrentHashMap map = (ConcurrentHashMap) DataSerializer.readObject(in);
     try {
       Field field = getAttributesFieldObject();
-      field.setAccessible(true);
-      field.set(this, newMap);
+      field.set(this, map);
     } catch (NoSuchFieldException e) {
       logError(e);
+      throw new NoSuchElementException(e.getMessage());
     } catch (IllegalAccessException e) {
       logError(e);
+      throw new IllegalStateException(e);
     }
   }
 
   protected Field getAttributesFieldObject() throws NoSuchFieldException {
-    return StandardSession.class.getDeclaredField("attributes");
+    if (cachedField == null) {
+      cachedField = StandardSession.class.getDeclaredField("attributes");
+      cachedField.setAccessible(true);
+    }
+    return cachedField;
   }
 
   protected void logError(Exception e) {
@@ -597,10 +602,10 @@ public class DeltaSession extends StandardSession
   }
 
   @SuppressWarnings({"unchecked", "rawtypes"})
-  protected ConcurrentMap<String, byte[]> getSerializedAttributes() {
+  protected Map<String, byte[]> getSerializedAttributes() {
     // Iterate the values and serialize them if necessary before sending them to the server. This
     // makes the application classes unnecessary on the server.
-    ConcurrentMap<String, byte[]> serializedAttributes = new ConcurrentHashMap<>();
+    Map<String, byte[]> serializedAttributes = new ConcurrentHashMap<>();
     for (Iterator i = getAttributes().entrySet().iterator(); i.hasNext();) {
       Map.Entry<String, Object> entry = (Map.Entry<String, Object>) i.next();
       Object value = entry.getValue();
@@ -610,18 +615,15 @@ public class DeltaSession extends StandardSession
     return serializedAttributes;
   }
 
-  protected ConcurrentMap getAttributes() {
+  protected Map getAttributes() {
     try {
       Field field = getAttributesFieldObject();
-      field.setAccessible(true);
-      Map oldMap = (Map) field.get(this);
-      ConcurrentMap newMap = new ConcurrentHashMap();
-      newMap.putAll(oldMap);
-      return newMap;
+      Map map = (Map) field.get(this);
+      return map;
     } catch (Exception e) {
       logError(e);
     }
-    return null;
+    throw new NoSuchElementException("Unable to access attributes field");
   }
 
   protected byte[] serialize(Object obj) {

http://git-wip-us.apache.org/repos/asf/geode/blob/d282ec44/geode-old-versions/build.gradle
----------------------------------------------------------------------
diff --git a/geode-old-versions/build.gradle b/geode-old-versions/build.gradle
index b5adc56..2e9257c 100644
--- a/geode-old-versions/build.gradle
+++ b/geode-old-versions/build.gradle
@@ -24,7 +24,7 @@ disableMavenPublishing()
 
 project.ext.installs = new Properties();
 
-def addOldVersion(def source, def geodeVersion) {
+def addOldVersion(def source, def geodeVersion, def downloadInstall) {
   sourceSets.create(source, {
     compileClasspath += configurations.provided
     runtimeClasspath += configurations.provided
@@ -64,7 +64,9 @@ def addOldVersion(def source, def geodeVersion) {
     into buildDir
   }
 
-  createGeodeClasspathsFile.dependsOn tasks["downloadAndUnzipFile${source}"]
+  if (downloadInstall) {
+    createGeodeClasspathsFile.dependsOn tasks["downloadAndUnzipFile${source}"]
+  }
 }
 
 def generatedResources = "$buildDir/generated-resources/main"
@@ -102,10 +104,10 @@ task createGeodeClasspathsFile  {
 
   // Add sourceSets for backwards compatibility, rolling upgrade, and
   // pdx testing.
-  addOldVersion('test100', '1.0.0-incubating')
-  addOldVersion('test110', '1.1.0')
-  addOldVersion('test111', '1.1.1')
-  addOldVersion('test120', '1.2.0')
+  addOldVersion('test100', '1.0.0-incubating', false)
+  addOldVersion('test110', '1.1.0', false)
+  addOldVersion('test111', '1.1.1', false)
+  addOldVersion('test120', '1.2.0', true)
 
 }