You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ea...@apache.org on 2013/03/04 22:45:12 UTC
svn commit: r1452543 -
/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
Author: eae
Date: Mon Mar 4 21:45:11 2013
New Revision: 1452543
URL: http://svn.apache.org/r1452543
Log:
UIMA-2712 cache number of types to avoid deadlocks
Modified:
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1452543&r1=1452542&r2=1452543&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Mon Mar 4 21:45:11 2013
@@ -181,6 +181,8 @@ public class TypeSystemImpl implements T
private int numCommittedTypes = 0;
+ private int numTypeNames = 0;
+
final CASMetadata casMetadata; // needs to be visible in package
boolean areBuiltInTypesSetup = false;
@@ -827,6 +829,9 @@ public class TypeSystemImpl implements T
* Get the overall number of types defined in the type system.
*/
public int getNumberOfTypes() {
+ if (this.isCommitted()) {
+ return this.numTypeNames;
+ }
return this.typeNameST.size();
}
@@ -1080,6 +1085,7 @@ public class TypeSystemImpl implements T
// because subsumes depends on it
// and generator initialization uses subsumes
this.numCommittedTypes = this.types.size(); // do before
+ this.numTypeNames = this.typeNameST.size();
// cas.commitTypeSystem -
// because it will call the type system iterator
this.casMetadata.setupFeaturesAndCreatableTypes();