Revision: 18636
          http://sourceforge.net/p/gate/code/18636
Author:   markagreenwood
Date:     2015-04-13 16:29:15 +0000 (Mon, 13 Apr 2015)
Log Message:
-----------
moved the compund doc and merging inst into the execute method so that when a 
document has been processed all info regarding it is thrown away and becomes 
available for GC

Modified Paths:
--------------
    
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java

Modified: 
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java
===================================================================
--- 
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java   
    2015-04-13 14:43:04 UTC (rev 18635)
+++ 
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java   
    2015-04-13 16:29:15 UTC (rev 18636)
@@ -76,36 +76,8 @@
    */
   private String inputASName;
 
-  /**
-   * Used internally - this is the document that will be used for holding the
-   * original document and the composite documents.
-   */
-  private CompoundDocument compoundDoc;
-
-  /**
-   * Method used for creating a new composite document.
-   */
-  protected CombiningMethod combiningMethodInst;
-
   private boolean debug = false;
 
-  /** Initialise this resource, and return it. */
-  public Resource init() throws ResourceInstantiationException {
-    // a combining method that creates a composite document with the
-    // annotation as identified by the annotation id
-    combiningMethodInst = new CombineFromAnnotID();
-    compoundDoc = new CompoundDocumentImpl();
-    // initializing an empty compound document
-    compoundDoc.init();
-    return this;
-  }
-
-  /* this method is called to reinitialize the resource */
-  public void reInit() throws ResourceInstantiationException {
-    // reinitialization code
-    init();
-  }
-
   /**
    * Should be called to execute this PR on a document.
    */
@@ -122,6 +94,19 @@
           + " in the document: " + document.getName());
       return;
     }
+    
+    // a combining method that creates a composite document with the
+    // annotation as identified by the annotation id
+    CombiningMethod combiningMethodInst = new CombineFromAnnotID();
+    
+    CompoundDocument compoundDoc = new CompoundDocumentImpl();
+    // initializing an empty compound document
+    try {
+      compoundDoc.init();
+    } catch(ResourceInstantiationException e) {
+      throw new ExecutionException(e);
+    }
+    
     String originalDocument = document.getName();
     if(document instanceof CompoundDocument) {
       if(debug) {
@@ -214,6 +199,8 @@
       // make sure you are resetting the reference
       analyser.setCorpus(oldCorpus);
       analyser.setDocument(oldDoc);
+      
+      Factory.deleteResource(compoundDoc);
 
       compoundDoc.removeDocument(originalDocument);
       if(tempCorpus != null) {
@@ -317,11 +304,4 @@
     this.segmentAnnotationFeatureValue = segmentAnnotationFeatureValue;
   }
 
-  /**
-   * must clean up the original compound document.
-   */
-  public void cleanup() {
-    super.cleanup();
-    Factory.deleteResource(compoundDoc);
-  }
 } // class SegmentProcessingPR

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to