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/12 22:22:02 UTC
svn commit: r1455721 -
/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
Author: eae
Date: Tue Mar 12 21:22:02 2013
New Revision: 1455721
URL: http://svn.apache.org/r1455721
Log:
UIMA-2712 cache number of types (and features!) 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=1455721&r1=1455720&r2=1455721&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 Tue Mar 12 21:22:02 2013
@@ -183,6 +183,8 @@ public class TypeSystemImpl implements T
private int numTypeNames = 0;
+ private int numFeatureNames = 0;
+
final CASMetadata casMetadata; // needs to be visible in package
boolean areBuiltInTypesSetup = false;
@@ -822,6 +824,9 @@ public class TypeSystemImpl implements T
* Get the overall number of features defined in the type system.
*/
public int getNumberOfFeatures() {
+ if (this.isCommitted()) {
+ return this.numFeatureNames;
+ }
return this.featureNameST.size();
}
@@ -1086,6 +1091,7 @@ public class TypeSystemImpl implements T
// and generator initialization uses subsumes
this.numCommittedTypes = this.types.size(); // do before
this.numTypeNames = this.typeNameST.size();
+ this.numFeatureNames = this.featureNameST.size();
// cas.commitTypeSystem -
// because it will call the type system iterator
this.casMetadata.setupFeaturesAndCreatableTypes();