You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2020/06/29 13:43:55 UTC

[uima-uimaj] branch UIMA-6249_getJCasRegisteredType created (now ad579f5)

This is an automated email from the ASF dual-hosted git repository.

schor pushed a change to branch UIMA-6249_getJCasRegisteredType
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git.


      at ad579f5  [UIMA-6249] avoid sync in getJCasRegisteredType

This branch includes the following new commits:

     new ad579f5  [UIMA-6249] avoid sync in getJCasRegisteredType

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimaj] 01/01: [UIMA-6249] avoid sync in getJCasRegisteredType

Posted by sc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

schor pushed a commit to branch UIMA-6249_getJCasRegisteredType
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit ad579f5f18b969da3fde1d1e4b1cb9d5d65a71a4
Author: Marshall Schor <ms...@schor.com>
AuthorDate: Mon Jun 29 08:43:29 2020 -0500

    [UIMA-6249] avoid sync in getJCasRegisteredType
---
 .../src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
index 8b10dee..03a7c47 100644
--- a/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
+++ b/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
@@ -2620,7 +2620,11 @@ public class TypeSystemImpl implements TypeSystem, TypeSystemMgr, LowLevelTypeSy
    * @return - the type impl associated with that JCas cover class
    */
   public TypeImpl getJCasRegisteredType(int i) {
-    TypeImpl ti;
+    // first try without sync lock https://issues.apache.org/jira/browse/UIMA-6249
+    TypeImpl ti = (i >= jcasRegisteredTypes.size()) ? null : jcasRegisteredTypes.get(i);
+    if (ti != null) {
+      return ti;
+    }
     synchronized(jcasRegisteredTypes) {
       ti = (i >= jcasRegisteredTypes.size()) ? null : jcasRegisteredTypes.get(i);
     }