ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1823185 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/AbstractPatientFileWriter.java
Date Mon, 05 Feb 2018 15:14:56 GMT
Author: seanfinan
Date: Mon Feb  5 15:14:56 2018
New Revision: 1823185

URL: http://svn.apache.org/viewvc?rev=1823185&view=rev
Log:
synchronize write on complete

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/AbstractPatientFileWriter.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/AbstractPatientFileWriter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/AbstractPatientFileWriter.java?rev=1823185&r1=1823184&r2=1823185&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/AbstractPatientFileWriter.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/patient/AbstractPatientFileWriter.java
Mon Feb  5 15:14:56 2018
@@ -24,6 +24,8 @@ abstract public class AbstractPatientFil
 
    static private final Logger LOGGER = Logger.getLogger( "AbstractPatientFileWriter" );
 
+   static private final Object DATA_LOCK = new Object();
+
    private final Collection<JCas> _patientCases = new HashSet<>();
 
    protected void AbstractFileWriter() {
@@ -67,15 +69,20 @@ abstract public class AbstractPatientFil
    }
 
    /**
+    * Write any remaining patient information
     * {@inheritDoc}
     */
    @Override
    public void collectionProcessComplete() throws AnalysisEngineProcessException {
       super.collectionProcessComplete();
       final String outputDir = getOutputDirectory( null, getRootDirectory(), "" );
-      createData( null );
       try {
-         writeFile( getData(), outputDir, "", "" );
+         synchronized ( DATA_LOCK ) {
+            createData( null );
+            final Collection<JCas> data = getData();
+            writeFile( data, outputDir, "", "" );
+            writeComplete( data );
+         }
       } catch ( IOException ioE ) {
          throw new AnalysisEngineProcessException( ioE );
       }



Mime
View raw message