geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [38/51] [abbrv] geronimo-yoko git commit: Avoid duplicate processing with selective locking, improving performance.
Date Sun, 19 Feb 2017 01:49:55 GMT
Avoid duplicate processing with selective locking, improving performance.


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

Branch: refs/heads/master
Commit: 6c4cc03cd56214aa7e97ff61941dacac3a90bc9d
Parents: 9caa74b
Author: Neil GM Richards <neil_richards@uk.ibm.com>
Authored: Tue Jun 21 02:36:54 2016 +0100
Committer: Neil GM Richards <neil_richards@uk.ibm.com>
Committed: Tue Jun 21 02:57:17 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java  | 9 ++++++---
 .../main/java/org/apache/yoko/rmi/impl/ValueDescriptor.java | 9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/6c4cc03c/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
----------------------------------------------------------------------
diff --git a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
index ed66893..aea1298 100755
--- a/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
+++ b/yoko-rmi-impl/src/main/java/org/apache/yoko/rmi/impl/TypeDescriptor.java
@@ -208,14 +208,17 @@ abstract class TypeDescriptor extends ModelElement {
 
     @Override
     protected void init() {
-        typeCode = genTypeCode();
+        getTypeCode();
     }
 
     private volatile TypeCode typeCode = null;
     protected abstract TypeCode genTypeCode();
     final TypeCode getTypeCode() {
-        // typeCode should have already been set from within init(), so this is just defensive
-        if (null == typeCode) typeCode = genTypeCode();
+        if (null == typeCode) {
+            synchronized (repo) {
+                if (null == typeCode) typeCode = genTypeCode();
+            }
+        }
         return typeCode;
     }
     protected final void setTypeCode(TypeCode tc) {

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/6c4cc03c/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 eb91e9f..6e66d1c 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
@@ -831,9 +831,12 @@ class ValueDescriptor extends TypeDescriptor {
         return members;
     }
     final ValueMember[] getValueMembers() {
-        getTypeCode(); // ensure recursion through typecode for non-array types
-
-        if (null == valueMembers) valueMembers = genValueMembers();
+        getTypeCode(); // ensure recursion through typecode
+        if (null == valueMembers) {
+            synchronized (repo) {
+                if (null == valueMembers) valueMembers = genValueMembers();
+            }
+        }
         return valueMembers;
     }
 


Mime
View raw message