geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [37/51] [abbrv] geronimo-yoko git commit: Correct ValueMembers creation, caching for ValueDescriptor, ArrayDescriptor
Date Sun, 19 Feb 2017 01:49:54 GMT
Correct ValueMembers creation, caching for ValueDescriptor, ArrayDescriptor


Project: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/repo
Commit: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/commit/9caa74b1
Tree: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/tree/9caa74b1
Diff: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/diff/9caa74b1

Branch: refs/heads/master
Commit: 9caa74b1fb2b877514bc08f455db3b05e2df40f7
Parents: 647ffd7
Author: Neil GM Richards <neil_richards@uk.ibm.com>
Authored: Mon Jun 20 20:01:51 2016 +0100
Committer: Neil GM Richards <neil_richards@uk.ibm.com>
Committed: Mon Jun 20 20:01:51 2016 +0100

----------------------------------------------------------------------
 .../apache/yoko/rmi/impl/ArrayDescriptor.java   | 25 +++++++-------------
 .../apache/yoko/rmi/impl/ValueDescriptor.java   | 21 ++++++++--------
 2 files changed, 20 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/9caa74b1/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
index 2cedbfa..ca4e0b1 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ArrayDescriptor.java
@@ -185,27 +185,20 @@ abstract class ArrayDescriptor extends ValueDescriptor {
         _out.write_value((Serializable)value, getRepositoryID());
     }
 
-    ValueMember[] getValueMembers() {
-
-        if (_value_members == null) {
-
-            _value_members = new ValueMember[1];
-
-            TypeDescriptor elemDesc = repo.getDescriptor(elementType);
-
-            String elemRepID = elemDesc.getRepositoryID();
+    @Override
+    protected final ValueMember[] genValueMembers() {
+        final ValueMember[] members = new ValueMember[1];
+        final TypeDescriptor elemDesc = repo.getDescriptor(elementType);
+        final String elemRepID = elemDesc.getRepositoryID();
 
-            ORB orb = ORB.init();
-            TypeCode memberTC = orb.create_sequence_tc(0, elemDesc
-                    .getTypeCode());
+        final ORB orb = ORB.init();
+        TypeCode memberTC = orb.create_sequence_tc(0, elemDesc.getTypeCode());
 
-            _value_members[0] = new ValueMember("", // member has no name!
+        members[0] = new ValueMember("", // member has no name!
                     elemRepID, this.getRepositoryID(), "1.0", memberTC, null,
                     (short) 1);
-            // public
-        }
 
-        return _value_members;
+        return members;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/9caa74b1/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
index e6b1849..eb91e9f 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java
@@ -821,19 +821,20 @@ class ValueDescriptor extends TypeDescriptor {
         return _hash_code;
     }
 
-    protected ValueMember[] _value_members = null;
+    private volatile ValueMember[] valueMembers = null;
+    protected ValueMember[] genValueMembers() {
+        final ValueMember[] members = new ValueMember[_fields.length];
+        for (int i = 0; i < _fields.length; i++) {
+            members[i] = _fields[i].getValueMember(repo);
+        }
 
-    private ValueMember[] getValueMembers() {
+        return members;
+    }
+    final ValueMember[] getValueMembers() {
         getTypeCode(); // ensure recursion through typecode for non-array types
 
-        if (_value_members == null) {
-            _value_members = new ValueMember[_fields.length];
-            for (int i = 0; i < _fields.length; i++) {
-                _value_members[i] = _fields[i].getValueMember(repo);
-            }
-        }
-
-        return _value_members;
+        if (null == valueMembers) valueMembers = genValueMembers();
+        return valueMembers;
     }
 
     @Override


Mime
View raw message