Package org.apache.uima.collection.base_cpm

Examples of org.apache.uima.collection.base_cpm.SynchPoint


      try {
        out = new FileOutputStream(fileName);
        synchPointOut = new FileOutputStream(synchPointFileName);
        s = new ObjectOutputStream(out);
        SynchPoint synchPoint = cpm.getSynchPoint();

        ProcessTrace pTrace = cpm.getPerformanceReport();
        CheckpointData targetToSave = null;
        if (pTrace != null) {
          if (synchPoint != null) {
            if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
              UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
                      this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_checkpoint_with_synchpoint__FINEST",
                      new Object[] { Thread.currentThread().getName() });
            }
            targetToSave = new CheckpointData(pTrace, synchPoint);
          } else {
            if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
              UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
                      this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_checkpoint_with_pt__FINEST",
                      new Object[] { Thread.currentThread().getName() });
            }
            targetToSave = new CheckpointData(pTrace);
          }
          synchronized (targetToSave) {
            s.writeObject(targetToSave);
            s.flush();
            if (synchPoint != null) {
              String xmlSynchPoint = synchPoint.serializeToXML();
              synchPointOut.write(xmlSynchPoint.getBytes());
              synchPointOut.flush();
            }
          }
        }
View Full Code Here


          }
        }
      }
      file = new File(synchPointFileName);
      // Read the synchpoint from the filesystem.
      SynchPoint synchPoint = null;
      if (file.exists()) {
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
                  "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                  "UIMA_CPM_synchpoint_from_file__FINEST",
                  new Object[] { Thread.currentThread().getName(), synchPointFileName });
        }
        synchPointStream = new FileInputStream(file);
        if (synchPointStream != null) {
          // Use the SynchPoint object retrieved above. Its internal data should be
          // overwritten during deserialization done below. Its just a convenience to
          // reuse the same object that was saved as part of a checkpoint.
          if (anObject != null && anObject instanceof CheckpointData) {
            synchPoint = ((CheckpointData) anObject).getSynchPoint();
            if (synchPoint != null) {
              synchPoint.deserialize(synchPointStream);
            }
          }
        }
      }
View Full Code Here

   * current snapshot that includes the last document processed.
   *
   * @return - instance of SynchPoint if the Collection Reader is recoverable, null otherwise
   */
  public SynchPoint getSynchPoint() {
    SynchPoint synchPoint = null;
    // Check if the CR is recoverable
    if (collectionReader != null && collectionReader instanceof RecoverableCollectionReader) {
      synchPoint = ((RecoverableCollectionReader) collectionReader).getSynchPoint();
    }
    return synchPoint;
View Full Code Here

      try {
        out = new FileOutputStream(fileName);
        synchPointOut = new FileOutputStream(synchPointFileName);
        s = new ObjectOutputStream(out);
        SynchPoint synchPoint = cpm.getSynchPoint();

        ProcessTrace pTrace = cpm.getPerformanceReport();
        CheckpointData targetToSave = null;
        if (pTrace != null) {
          if (synchPoint != null) {
            if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
              UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
                      this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_checkpoint_with_synchpoint__FINEST",
                      new Object[] { Thread.currentThread().getName() });
            }
            targetToSave = new CheckpointData(pTrace, synchPoint);
          } else {
            if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
              UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST,
                      this.getClass().getName(), "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_checkpoint_with_pt__FINEST",
                      new Object[] { Thread.currentThread().getName() });
            }
            targetToSave = new CheckpointData(pTrace);
          }
          synchronized (targetToSave) {
            s.writeObject(targetToSave);
            s.flush();
            if (synchPoint != null) {
              String xmlSynchPoint = synchPoint.serializeToXML();
              synchPointOut.write(xmlSynchPoint.getBytes());
              synchPointOut.flush();
            }
          }
        }
View Full Code Here

          }
        }
      }
      file = new File(synchPointFileName);
      // Read the synchpoint from the filesystem.
      SynchPoint synchPoint = null;
      if (file.exists()) {
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).logrb(Level.FINEST, this.getClass().getName(),
                  "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                  "UIMA_CPM_synchpoint_from_file__FINEST",
                  new Object[] { Thread.currentThread().getName(), synchPointFileName });
        }
        synchPointStream = new FileInputStream(file);
        if (synchPointStream != null) {
          // Use the SynchPoint object retrieved above. Its internal data should be
          // overwritten during deserialization done below. Its just a convenience to
          // reuse the same object that was saved as part of a checkpoint.
          if (anObject != null && anObject instanceof CheckpointData) {
            synchPoint = ((CheckpointData) anObject).getSynchPoint();
            if (synchPoint != null) {
              synchPoint.deserialize(synchPointStream);
            }
          }
        }
      }
View Full Code Here

   * current snapshot that includes the last document processed.
   *
   * @return - instance of SynchPoint if the Collection Reader is recoverable, null otherwise
   */
  public SynchPoint getSynchPoint() {
    SynchPoint synchPoint = null;
    // Check if the CR is recoverable
    if (collectionReader != null && collectionReader instanceof RecoverableCollectionReader) {
      synchPoint = ((RecoverableCollectionReader) collectionReader).getSynchPoint();
    }
    return synchPoint;
View Full Code Here

   * current snapshot that includes the last document processed.
   *
   * @return - instance of SynchPoint if the Collection Reader is recoverable, null otherwise
   */
  public SynchPoint getSynchPoint() {
    SynchPoint synchPoint = null;
    // Check if the CR is recoverable
    if (collectionReader != null && collectionReader instanceof RecoverableCollectionReader) {
      synchPoint = ((RecoverableCollectionReader) collectionReader).getSynchPoint();
    }
    return synchPoint;
View Full Code Here

   * current snapshot that includes the last document processed.
   *
   * @return - instance of SynchPoint if the Collection Reader is recoverable, null otherwise
   */
  public SynchPoint getSynchPoint() {
    SynchPoint synchPoint = null;
    // Check if the CR is recoverable
    if (collectionReader != null && collectionReader instanceof RecoverableCollectionReader) {
      synchPoint = ((RecoverableCollectionReader) collectionReader).getSynchPoint();
    }
    return synchPoint;
View Full Code Here

TOP

Related Classes of org.apache.uima.collection.base_cpm.SynchPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.