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 2007/06/07 20:25:37 UTC

svn commit: r545257 - /incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java

Author: schor
Date: Thu Jun  7 11:25:36 2007
New Revision: 545257

URL: http://svn.apache.org/viewvc?view=rev&rev=545257
Log:
[UIMA-409] bad optimization - can't share initargs in createFS for JCas among multiple 
threads - change to local variable.

Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java?view=diff&rev=545257&r1=545256&r2=545257
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java Thu Jun  7 11:25:36 2007
@@ -55,7 +55,7 @@
   static private class JCasFsGenerator implements FSGenerator {
     private final int type;
     private final Constructor c;
-    private final Object[] initargs;
+
     private final boolean isSubtypeOfAnnotationBase;
     private final int sofaNbrFeatCode;
     private final int annotSofaFeatCode;
@@ -63,7 +63,6 @@
     JCasFsGenerator(int type, Constructor c, boolean isSubtypeOfAnnotationBase, int sofaNbrFeatCode, int annotSofaFeatCode) {
       this.type = type;  
       this.c = c;
-      initargs = new Object[] {null, null};
       this.isSubtypeOfAnnotationBase = isSubtypeOfAnnotationBase;
       this.sofaNbrFeatCode = sofaNbrFeatCode;
       this.annotSofaFeatCode = annotSofaFeatCode;
@@ -74,6 +73,7 @@
     //   2) a dereference of an existing FS
     //   3) an iterator
     public FeatureStructure createFS(int addr, CASImpl casView) {
+      Object [] initargs = new Object[2];
       JCasImpl jcasView = null;
       // this funny logic is because although the annotationView should always be set if
       //  a type is a subtype of annotation, it isn't always set if an application uses low-level 
@@ -113,7 +113,6 @@
         } 
         jcasView.putJfsFromCaddr(addr, fs);
       }
-      initargs[0] = initargs[1] = null; // better gc
       return fs;
     }
  
@@ -204,6 +203,11 @@
   public void addGeneratorForType(TypeImpl type, FSGenerator fsFactory) {
     this.generators[type.getCode()] = fsFactory;
   }
+  
+  // Internal use only
+  public FSGenerator getGeneratorForType(TypeImpl type) {
+    return this.generators[type.getCode()];
+  }
 
   /**
    * copies a generator for a type into another type. Called by JCas after basic types are created
@@ -254,4 +258,6 @@
     FSGenerator fsGenerator = new JCasFsGenerator(type, c, isSubtypeOfAnnotationBase, ts.sofaNumFeatCode, ts.annotSofaFeatCode);
     addGeneratorForType(casType, fsGenerator);
   }
+  
+  
 }