Package org.apache.uima.collection.impl

Examples of org.apache.uima.collection.impl.EntityProcessStatusImpl


          // cache the docId in the list of documents that have been marked as invalid
          addDocToTimedOutDocs(10000, docId);
          // Notify the listeners of the timeout
          CPMChunkTimeoutException toe = new CPMChunkTimeoutException(Long.parseLong(docId),
                  nextChunkMetadata.getThrottleID(), nextChunkMetadata.getURL());
          EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(null);
          enProcSt.addEventStatus("Process", "Failed", toe);
          doNotifyListeners(null, enProcSt);
        }
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).logrb(
                  Level.FINEST,
View Full Code Here


  private void notifyListeners(CAS aCas, Exception anException) {
    for (int i = 0; callbackListeners != null && i < callbackListeners.size(); i++) {
      StatusCallbackListener statCL = (StatusCallbackListener) callbackListeners.get(i);
      if ( statCL != null ) {
        ProcessTrace prTrace = new ProcessTrace_impl(cpm.getPerformanceTuningSettings());
        EntityProcessStatusImpl aEntityProcStatus = new EntityProcessStatusImpl(prTrace);
        aEntityProcStatus.addEventStatus("Collection Reader Failure", "failed", anException);
        // Notify the listener that the Cas has been processed
        CPMEngine.callEntityProcessCompleteWithCAS(statCL, aCas, aEntityProcStatus);
//        statCL.entityProcessComplete(aCas, aEntityProcStatus);
      }
    }
View Full Code Here

          // cache the docId in the list of documents that have been marked as invalid
          addDocToTimedOutDocs(10000, docId);
          // Notify the listeners of the timeout
          CPMChunkTimeoutException toe = new CPMChunkTimeoutException(Long.parseLong(docId),
                  nextChunkMetadata.getThrottleID(), nextChunkMetadata.getURL());
          EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(null);
          enProcSt.addEventStatus("Process", "Failed", toe);
          doNotifyListeners(null, enProcSt);
        }
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).logrb(
                  Level.FINEST,
View Full Code Here

    }
    // System.out.println("ThreadGroup.uncaughtException()-Done Handling Error");
  }

  private void notifyListener(BaseStatusCallbackListener aStatCL, Throwable e) {
    EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(procTr);
    enProcSt.addEventStatus("Process", "Failed", e);
    ((StatusCallbackListener) aStatCL).entityProcessComplete(null, enProcSt);
  }
View Full Code Here

          if (((WorkUnit) entity).isTimedOut() && artifact instanceof CAS[]) {

            for (int i = 0; i < artifact.length && artifact[i] != null; i++) {
              ChunkMetadata meta = CPMUtils.getChunkMetadata((CAS) artifact[i]);
              if (meta != null) {
                EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(
                        processingUnitProcessTrace);
                enProcSt.addEventStatus("Process", "Failed", new SkipCasException(
                        "Dropping CAS due chunk Timeout. Doc Id::" + meta.getDocId() + " Sequence:"
                                + meta.getSequence()));
                doNotifyListeners(artifact[i], true, enProcSt);
              } else {
                EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(
                        processingUnitProcessTrace);
                enProcSt.addEventStatus("Process", "Failed", new SkipCasException(
                        "Dropping CAS due chunk Timeout. Chunk Metadata is not available."));
                doNotifyListeners(artifact[i], true, enProcSt);
              }
              releaseTimedOutCases(artifact);
            }
View Full Code Here

          // Release the CAS and notify listeners if the end of the
          // pipeline is reached.
          if ((releaseCAS) && (i == (processContainers.size() - 1))) {
            // This flag is used to prevent multiple notifications
            doneAlready = true;
            EntityProcessStatus aEntityProcStatus = new EntityProcessStatusImpl(pTrTemp);
            maybeLogFinest("UIMA_CPM_notify_listeners__FINEST");
            threadState = 2007;

            notifyListeners(aCasObjectList, isCasObject, aEntityProcStatus);
            if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
              logFinest("UIMA_CPM_done_notify_listeners__FINEST");
              logFinest("UIMA_CPM_releasing_cases__FINEST",
                container.getName(), String.valueOf(releaseCAS), "true");
            }
            if (casCache != null) {
              clearCasCache();
            }
            // Release CAS's.
            if (aCasObjectList instanceof CAS[]) {
              cpm.releaseCASes((CAS[]) aCasObjectList);
            }

            maybeLogFinest("UIMA_CPM_done_releasing_cases__FINEST", container);
          }

          maybeLogFinest("UIMA_CPM_pipeline_completed__FINEST");
          retry = false;
          // On successfull processing reset the restart counter. Restart counter determines how
          // many times to restart Cas Processor on the same CAS
          // Do this conditionally. If the CAS is to be dropped on Exception this restart counter
          // scope extends to the entire collection not just one CAS
          if (!cpm.dropCasOnException()) {
            container.resetRestartCount();
          }
        } catch (Exception e) {
          e.printStackTrace();
          if (UIMAFramework.getLogger().isLoggable(Level.SEVERE)) {

            logSevere("UIMA_CPM_pipeline_exception__SEVERE", container.getName(), e.getMessage());

            maybeLogSevereException(e);

            logFinest("UIMA_CPM_pipeline_exception__FINEST",
                container.getName(), String.valueOf(container.isPaused()));
          }

          EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(pTrTemp);
          enProcSt.addEventStatus("Process", "Failed", e);
          threadState = 2008;

          notifyListeners(aCasObjectList, isCasObject, enProcSt);
          doneAlready = true;
          threadState = 2009;
View Full Code Here

      // Notify Listeners that the entity has been processed.
      if (!doneAlready && notifyListeners) {
        maybeLogFinest("UIMA_CPM_notify_listeners__FINEST");
        threadState = 2013;
        // Notif Listeners
        EntityProcessStatus aEntityProcStatus = new EntityProcessStatusImpl(aProcessTr);
        notifyListeners(aCasObjectList, isCasObject, aEntityProcStatus);
        threadState = 2014;
        maybeLogFinest("UIMA_CPM_done_notify_listeners__FINEST");
      }
      // enqueue CASes. If the CPM is in shutdown mode due to hard kill dont allow enqueue of CASes
View Full Code Here

    e.printStackTrace();
    maybeLogSevereException(e);
    maybeLogSevere("UIMA_CPM_handle_exception__SEVERE",
        containerName, aProcessor.getClass().getName(), e.getMessage());

    EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(aProcessTrace);
    enProcSt.addEventStatus("Process", "Failed", e);
    threadState = 2008;
    // Send exception notifications to all registered listeners
    notifyListeners(aCasObjectList, isCasObject, enProcSt);
    threadState = 2009;
View Full Code Here

   */
  private void notifyListenersWithException(Exception e) {
    UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, e.getMessage(), e);

    ArrayList statusCbL = this.getCallbackListeners();
    EntityProcessStatusImpl enProcSt = new EntityProcessStatusImpl(procTr, true);
    // e is the actual exception.
    enProcSt.addEventStatus("CPM", "Failed", e);

    // Notify all listeners that the CPM has finished processing
    for (int j = 0; statusCbL != null && j < statusCbL.size(); j++) {
      BaseStatusCallbackListener st = (BaseStatusCallbackListener) statusCbL.get(j);
      if (st instanceof StatusCallbackListener) {
View Full Code Here

  private void notifyListeners(int aMsgType, Object[] entity, ProcessTrace aPTrace, Throwable t) {
    // Add Callback Listeners
    for (int j = 0; j < statusCbL.size(); j++) {
      BaseStatusCallbackListener statCL = (BaseStatusCallbackListener) statusCbL.get(j);
      if (statCL != null) {
        EntityProcessStatusImpl eps = new EntityProcessStatusImpl(aPTrace);
        // eps = new EntityProcessStatusImpl(aPTrace);
        if (entity == null) {
          if (t != null) {
            eps.addEventStatus("Process", "Failed", t);
          }
          ((StatusCallbackListener) statCL).entityProcessComplete(null, eps);
        } else {
          for (int i = 0; i < entity.length; i++) {
            if (t != null) {
              eps.addEventStatus("Process", "Failed", t);
            }
            if (entity[i] != null && entity[i] instanceof CAS) {
              callEntityProcessCompleteWithCAS((StatusCallbackListener)statCL, (CAS)entity[i], eps);
//              ((StatusCallbackListener) statCL).entityProcessComplete((CAS) entity[i], eps);
            } else {
View Full Code Here

TOP

Related Classes of org.apache.uima.collection.impl.EntityProcessStatusImpl

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.