Examples of Threshold


Examples of org.apache.uima.aae.error.Threshold

        String delegateKey = ((AggregateAnalysisEngineController) controller)
                .lookUpDelegateKey(endpoint.getEndpoint());
        // If the delegate has a threshold defined on GetMeta apply Action defined
        if (delegateKey != null && thresholds.containsKey(delegateKey)) {
          // Fetch the Threshold object containing error configuration
          Threshold threshold = (Threshold) thresholds.get(delegateKey);
          // Check if the delegate needs to be disabled
          if (threshold.getAction().equalsIgnoreCase(ErrorHandler.DISABLE)) {
            // The disable delegate method takes a list of delegates
            List list = new ArrayList();
            // Add the delegate to disable to the list
            list.add(delegateKey);
            try {
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

        String delegateKey = ((AggregateAnalysisEngineController) controller)
                .lookUpDelegateKey(endpoint.getEndpoint());
        // If the delegate has a threshold defined on GetMeta apply Action defined
        if (delegateKey != null && thresholds.containsKey(delegateKey)) {
          // Fetch the Threshold object containing error configuration
          Threshold threshold = (Threshold) thresholds.get(delegateKey);
          // Check if the delegate needs to be disabled
          if (threshold.getAction().equalsIgnoreCase(ErrorHandler.DISABLE)) {
            // The disable delegate method takes a list of delegates
            List list = new ArrayList();
            // Add the delegate to disable to the list
            list.add(delegateKey);
            try {
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
              UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", t);
    }

    String key = "";
    Threshold threshold = null;
    boolean delegateDisabled = false;
    Delegate delegate = null;
    // R E T R Y
    // Do retry first if this an Aggregate Controller
    if (!isEndpointTheClient && aController instanceof AggregateAnalysisEngineController) {
      Endpoint endpoint = null;

      if (anErrorContext.get(AsynchAEMessage.Endpoint) != null) {
        endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
        key = ((AggregateAnalysisEngineController) aController).lookUpDelegateKey(endpoint
                .getEndpoint());
        delegate = ((AggregateAnalysisEngineController) aController).lookupDelegate(key);
      }
      threshold = super.getThreshold(endpoint, delegateMap, aController);
      if (endpoint != null) {
        // key =
        // ((AggregateAnalysisEngineController)aController).lookUpDelegateKey(endpoint.getEndpoint());
        delegateDisabled = ((AggregateAnalysisEngineController) aController)
                .isDelegateDisabled(key);
        if (threshold != null && threshold.getMaxRetries() > 0 && !delegateDisabled) {
          // If max retry count is not reached, send the last command again and return true
          if (super.retryLastCommand(AsynchAEMessage.Process, endpoint, aController, key,
                  threshold, anErrorContext)) {
            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(),
                      "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                      "UIMAEE_retry_cas__FINE",
                      new Object[] { aController.getComponentName(), key, casReferenceId });
            }
            return true; // Command has been retried. Done here.
          }
        } else if (threshold == null) {
          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG)) {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, getClass().getName(),
                    "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                    "UIMAEE_no_threshold_for_endpoint__CONFIG",
                    new Object[] { aController.getComponentName(), "Process", key });
          }
        }
        if (delegate != null) {
          // Received reply from the delegate. Remove the CAS from the
          // delegate's list of CASes pending reply
          // Delegate delegate =
          // ((AggregateAnalysisEngineController)aController).lookupDelegate(key);
          delegate.removeCasFromOutstandingList(casReferenceId);
        }
      } else {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(),
                  "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_no_endpoint_provided__INFO",
                  new Object[] { aController.getComponentName() });
        }
      }
    } else {
      if (delegateMap != null && delegateMap.containsKey(key)) {
        threshold = (Threshold) delegateMap.get(key);
      }
    }

    if (key != null && key.trim().length() > 0) {
      // Retries either exceeded or not configured for retry
      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "handleError",
                UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cas_retries_exceeded__FINE",
                new Object[] { aController.getComponentName(), key, casReferenceId });
      }
    }
    boolean disabledDueToExceededThreshold = false;

    // Dont increment errors for destinations that are clients of this service.
    if (key != null && !aController.isStopped() && (isRequest || !isEndpointTheClient)) {
      synchronized (monitor) {
        // Dont increment errors for delegates that have been already disabled
        if (!delegateDisabled) {
          // Process Error Count is only incremented after retries are done.
          super.incrementStatistic(aController.getMonitor(), key, Monitor.ProcessErrorCount);
          super.incrementStatistic(aController.getMonitor(), key, Monitor.TotalProcessErrorCount);
          aController.getServiceErrors().incrementProcessErrors();
          if (aController instanceof AggregateAnalysisEngineController
                  && anErrorContext.get(AsynchAEMessage.Endpoint) != null) {
            Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
            if (endpoint.isRemote()) {
              ServiceErrors serviceErrs = ((AggregateAnalysisEngineController) aController)
                      .getDelegateServiceErrors(key);
              if (serviceErrs != null) {
                serviceErrs.incrementProcessErrors();
              }
            }
          }

          /***
           * if (threshold != null && threshold.getThreshold() > 0 &&
           * super.exceedsThresholdWithinWindow(aController.getMonitor(), Monitor.ProcessErrorCount,
           * key, threshold) )
           */

          long procCount = aController.getMonitor().getLongNumericStatistic(key,
                  Monitor.ProcessCount).getValue();
          if (threshold != null && threshold.exceededWindow(procCount)) {
            if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
              UIMAFramework.getLogger(CLASS_NAME).logrb(
                      Level.INFO,
                      getClass().getName(),
                      "handleError",
                      UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                      "UIMAEE_process_cas_exceeded_threshold__INFO",
                      new Object[] { aController.getComponentName(), key, casReferenceId,
                          threshold.getThreshold(), threshold.getAction() });
            }
            // Add new property to skip handling of CASes in pending lists. Those CASes
            // will be handled later in this method, once we complete processing of the CAS
            // that caused the exception currently being processed. During handling of the
            // CASes in pending state, this error handler is called for each CAS to force
            // its timeout.
            disabledDueToExceededThreshold = ErrorHandler.DISABLE.equalsIgnoreCase(threshold
                    .getAction());
            if (disabledDueToExceededThreshold) {
              delegateKey = key;
              anErrorContext.add(AsynchAEMessage.SkipPendingLists, "true");
            }
            if (ErrorHandler.TERMINATE.equalsIgnoreCase(threshold.getAction())) {
              anErrorContext.add(ErrorContext.THROWABLE_ERROR, t);
              if (casReferenceId != null) {
                try {
                  CasStateEntry casStateEntry = aController.getLocalCache().lookupEntry(
                          casReferenceId);
                  if (casStateEntry != null && casStateEntry.isSubordinate()) {
                    CasStateEntry parenCasStateEntry = aController.getLocalCache()
                            .getTopCasAncestor(casReferenceId);
                    // Replace Cas Id with the parent Cas Id
                    anErrorContext.remove(AsynchAEMessage.CasReference);
                    anErrorContext.add(AsynchAEMessage.CasReference, parenCasStateEntry
                            .getCasReferenceId());
                  }
                } catch (Exception e) {
                }
              }

            }
            aController.takeAction(threshold.getAction(), key, anErrorContext);
            if (ErrorHandler.CONTINUE.equalsIgnoreCase(threshold.getAction())) {
              //  The following is only true if the Action=Continue and the FlowController is configured
              //  to continue on Exception in a delegate with a given key. The exception is provided
              //  in the anErrorContext. The controller, while handling exception in takeAction(), will set
              //  ErrorContext.ERROR_HANDLED property iff the FlowController says to continue.
              if (anErrorContext.containsKey(ErrorContext.ERROR_HANDLED) && (Boolean)anErrorContext.get(ErrorContext.ERROR_HANDLED) == true )
                //  The FlowController indicated to continue. The process() method was already called. No
                //  need to do anything else. At this point the error has been handled.
                return true;
            }
          }
        } else {
          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(),
                    "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                    "UIMAEE_delegate_already_disabled__INFO",
                    new Object[] { aController.getComponentName(), key, casReferenceId });
          }
        }
      }

    } else {
      Endpoint endpt = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
      if (endpt != null) {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(
                  Level.INFO,
                  getClass().getName(),
                  "handleError",
                  UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_process_exception__INFO",
                  new Object[] { aController.getComponentName(), endpt.getEndpoint(),
                      casReferenceId });
        }
      }
    }
    int totalNumberOfParallelDelegatesProcessingCas = 1; // default
    CacheEntry cacheEntry = null;
    CasStateEntry casStateEntry = null;
    try {
      casStateEntry = aController.getLocalCache().lookupEntry(casReferenceId);
      cacheEntry = aController.getInProcessCache().getCacheEntryForCAS(casReferenceId);
      if (cacheEntry != null) {
        totalNumberOfParallelDelegatesProcessingCas = casStateEntry.getNumberOfParallelDelegates();
      }

    } catch (Exception e) {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
                    "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                    "UIMAEE_parent_cas_notin_cache__INFO", new Object[] { aController.getComponentName(), casReferenceId });
        }
    }
    // Determine where to send the message
    Endpoint endpoint = getDestination(aController, anErrorContext);
    // If the error happened during a parallel step, treat the exception as response from the
    // delegate
    // When all responses from delegates are accounted for we allow the CAS to move on to the next
    // step in the flow. Dont increment parallel delegate response count if a delegate was just
    // disabled above. The count has been already incremented in handleAction() method of the
    // AnalysisEngineController.
    if casStateEntry != null
            && totalNumberOfParallelDelegatesProcessingCas > 1
            && (casStateEntry.howManyDelegatesResponded() < totalNumberOfParallelDelegatesProcessingCas)) {
      casStateEntry.incrementHowManyDelegatesResponded();
    }

    if (aController instanceof AggregateAnalysisEngineController && t instanceof Exception) {
      boolean flowControllerContinueFlag = false;
      // if the deployment descriptor says no retries, dont care what the Flow Controller says
      if (threshold != null && threshold.getContinueOnRetryFailure()) {
        try {
          // Consult Flow Controller to determine if it is ok to continue despite the error
          flowControllerContinueFlag = ((AggregateAnalysisEngineController) aController)
                  .continueOnError(casReferenceId, key, (Exception) t);
        } catch (Exception exc) {
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
              UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", t);
    }
    Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
    if (endpoint != null) {
      Threshold threshold = null;
      if (aController instanceof PrimitiveAnalysisEngineController) {
        threshold = (Threshold) delegateMap.get("");
      } else {
        threshold = super.getThreshold(endpoint, delegateMap, aController);
      }
      try {
        if (aController instanceof AggregateAnalysisEngineController) {
          endpoint = ((AggregateAnalysisEngineController) aController).getClientEndpoint();
        }
        aController.getOutputChannel().sendReply(t, null, null, endpoint,
                AsynchAEMessage.CollectionProcessComplete);
      } catch (Exception e) {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
          if ( aController != null ) {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                    "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                    "UIMAEE_service_exception_WARNING", aController.getComponentName());
          }

          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(),
                  "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                  "UIMAEE_exception__WARNING", e);
        }
      }

      if (threshold != null && threshold.getAction().equalsIgnoreCase(ErrorHandler.TERMINATE)) {
        aController.takeAction(threshold.getAction(), endpoint.getEndpoint(), anErrorContext);
      } else if (threshold == null) {
        if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG)) {
          UIMAFramework.getLogger(CLASS_NAME).logrb(
                  Level.CONFIG,
                  getClass().getName(),
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

              UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", t);
    }
    Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);

    if (endpoint != null && aController instanceof AggregateAnalysisEngineController) {
      Threshold threshold = super.getThreshold(endpoint, delegateMap, aController);
      String key = ((AggregateAnalysisEngineController) aController).lookUpDelegateKey(endpoint
              .getEndpoint());
      Delegate delegate = ((AggregateAnalysisEngineController) aController).lookupDelegate(key);
      if (delegate != null
              && delegate.isAwaitingPingReply()
              || threshold == null
              || threshold.getMaxRetries() == 0
              || (super.retryLastCommand(AsynchAEMessage.GetMeta, endpoint, aController, key,
                      threshold, anErrorContext) == false)) {
        if (terminate(threshold)) {
          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
                    "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                    "UIMAEE_terminate_service__INFO",
                    new Object[] { aController.getComponentName(), endpoint.getEndpoint() });
          }
          aController.terminate();
          // Notify if the error occurred during initialization of the service.
          // If the ping times out, there is no need to notify the listener. We
          // use getMeta request as a ping to check if the service is running.
          if (delegate != null && !delegate.isAwaitingPingReply() && t instanceof Exception) {
            aController.notifyListenersWithInitializationStatus((Exception) t);
          }
        } else {
          aController.takeAction(threshold.getAction(), endpoint.getEndpoint(), anErrorContext);
        }
      }
    } else {
      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(), "handleError",
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

        String delegateKey = ((AggregateAnalysisEngineController) controller)
                .lookUpDelegateKey(endpoint.getEndpoint());
        // If the delegate has a threshold defined on GetMeta apply Action defined
        if (delegateKey != null && thresholds.containsKey(delegateKey)) {
          // Fetch the Threshold object containing error configuration
          Threshold threshold = (Threshold) thresholds.get(delegateKey);
          // Check if the delegate needs to be disabled
          if (threshold.getAction().equalsIgnoreCase(ErrorHandler.DISABLE)) {
            // The disable delegate method takes a list of delegates
            List list = new ArrayList();
            // Add the delegate to disable to the list
            list.add(delegateKey);
            try {
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

            String delegateKey = ((AggregateAnalysisEngineController)controller).lookUpDelegateKey(endpoint.getEndpoint());
            //  If the delegate has a threshold defined on GetMeta apply Action defined
            if ( delegateKey != null && thresholds.containsKey(delegateKey))
            {
              //  Fetcg the Threshold object containing error configuration
              Threshold threshold = (Threshold) thresholds.get(delegateKey);
              //  Check if the delegate needs to be disabled
              if (threshold.getAction().equalsIgnoreCase(ErrorHandler.DISABLE)) {
                //  The disable delegate method takes a list of delegates
                List list = new ArrayList();
                //  Add the delegate to disable to the list
                list.add(delegateKey);
                try {
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

    Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);

    if ( endpoint != null && aController instanceof AggregateAnalysisEngineController )
    {
      Threshold threshold = super.getThreshold(endpoint, delegateMap, aController);
        String key = ((AggregateAnalysisEngineController)aController).lookUpDelegateKey(endpoint.getEndpoint());
        //  If threshold is not defined, assume action=terminate
        if threshold == null || threshold.getMaxRetries() == 0 ||
              ( super.retryLastCommand(AsynchAEMessage.GetMeta, endpoint, aController, key, threshold, anErrorContext) == false
                )
        {
          if ( terminate(threshold ) )
          {
            System.out.println("!!!!!!!!!!!! Exceeded Threshold Terminating !!!!!!!!!!!!!!");
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
                        "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_terminate_service__INFO",
                        new Object[] {aController.getComponentName(), endpoint.getEndpoint()});
            aController.terminate();
            aController.notifyListenersWithInitializationStatus((Exception)t);
          }
          else
          {
            aController.takeAction(threshold.getAction(), endpoint.getEndpoint(), anErrorContext);
          }
        }
    }
    else
    {
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

        return true;   // handled here. This message will not processed
    }

    String key = "";
    Threshold threshold = null;
    boolean delegateDisabled = false;
    //                       R E T R Y
    //  Do retry first if this an Aggregate Controller
    if ( !isEndpointTheClient && aController instanceof AggregateAnalysisEngineController )
    {
      Endpoint endpoint = null;
     
      if ( anErrorContext.get(AsynchAEMessage.Endpoint) != null )
      {
        endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
      }
      threshold = super.getThreshold(endpoint, delegateMap, aController);
      if ( endpoint != null )
      {
          key = ((AggregateAnalysisEngineController)aController).lookUpDelegateKey(endpoint.getEndpoint());
          delegateDisabled = ((AggregateAnalysisEngineController)aController).isDelegateDisabled(key);
          if ( threshold != null && threshold.getMaxRetries() > 0 && !delegateDisabled)
          {
            //  If max retry count is not reached, send the last command again and return true
            if ( super.retryLastCommand(AsynchAEMessage.Process, endpoint, aController, key, threshold, anErrorContext) )
            {
              UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "handleError",
                  UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_retry_cas__FINE", new Object[] { aController.getComponentName(), key, casReferenceId });
              return true;   // Command has been retried. Done here.
            }
          }
          else if ( threshold == null )
          {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_no_threshold_for_endpoint__CONFIG", new Object[] { aController.getComponentName(), "Process",  key });
          }
      }
      else
      {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_no_endpoint_provided__INFO", new Object[] { aController.getComponentName() });
      }
    }
    else
    {
        if ( delegateMap != null && delegateMap.containsKey(key))
        {
            threshold = (Threshold)delegateMap.get(key);
        }
    }

   
    if ( key != null && key.trim().length() > 0)
    {
      //  Retries either exceeded or not configured for retry
      UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "handleError",
          UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_cas_retries_exceeded__FINE", new Object[] { aController.getComponentName(), key, casReferenceId });
    }

    //  Dont increment errors for destinations that are clients of this service.
    if ( !aController.isStopped() && (isRequest || !isEndpointTheClient ) )
    {
      synchronized( monitor )
      {
        //  Dont increment errors for delegates that have been already disabled
        if ( !delegateDisabled )
        {
          //  Process Error Count is only incremented after retries are done.
          super.incrementStatistic(aController.getMonitor(), key, Monitor.ProcessErrorCount);
          super.incrementStatistic(aController.getMonitor(), key, Monitor.TotalProcessErrorCount);
          aController.getServiceErrors().incrementProcessErrors();
          if ( aController instanceof AggregateAnalysisEngineController && anErrorContext.get(AsynchAEMessage.Endpoint) != null )
          {
            Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
            if ( endpoint.isRemote())
            {
              ServiceErrors serviceErrs =
                ((AggregateAnalysisEngineController)aController).getDelegateServiceErrors(key);
//              ServiceErrors serviceErrs = ((AggregateAnalysisEngineController)aController).getServiceErrors(key);
              if (serviceErrs != null )
              {
                serviceErrs.incrementProcessErrors();
              }
            }
          }

          /***
          if (threshold != null && threshold.getThreshold() > 0 && super.exceedsThresholdWithinWindow(aController.getMonitor(), Monitor.ProcessErrorCount, key, threshold) )
          */

          long procCount = aController.getMonitor().getLongNumericStatistic(key, Monitor.ProcessCount).getValue();
          if (threshold != null && threshold.exceededWindow(procCount))
          {
            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(), "handleError",
                UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_process_cas_exceeded_threshold__INFO", new Object[] { aController.getComponentName(), key, casReferenceId, threshold.getThreshold(), threshold.getAction() });
            aController.takeAction(threshold.getAction(), key, anErrorContext);
          }
        }
        else
        {
          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, getClass().getName(), "handleError",
              UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_delegate_already_disabled__INFO", new Object[] { aController.getComponentName(), key, casReferenceId });
        }
      }
     
    }
    else
    {
      Endpoint endpt = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
      if ( endpt != null )
      {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, getClass().getName(), "handleError",
            UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception_while_sending_reply_to_client__FINE", new Object[] { aController.getComponentName(), endpt.getEndpoint(), casReferenceId });
      }
    }
   
    int totalNumberOfParallelDelegatesProcessingCas = 1; // default
    CacheEntry cacheEntry = null;
    try
    {
      cacheEntry = aController.getInProcessCache().getCacheEntryForCAS(casReferenceId);
      if ( cacheEntry != null )
      {
        totalNumberOfParallelDelegatesProcessingCas = cacheEntry.getNumberOfParallelDelegates();
      }

    }
    catch( Exception e) {}
    //  Determine where to send the message
    Endpoint endpoint = getDestination(aController, anErrorContext);
/*
    //  Notify the parent of the exception
    if ( endpoint != null && casReferenceId != null && !endpoint.isCasMultiplier())
    {
      try
      {
        aController.getOutputChannel().sendReply(t, casReferenceId, endpoint, AsynchAEMessage.Process);
        aController.dropStats(casReferenceId, endpoint.getEndpoint());
      }
      catch( Exception e)
      {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
            UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", e);
      }
    }
*/   
    //  If the error occured during parallel step, treat the exception as response from the delegate
    //  When all responses from delegates are accounted for we allow the CAS to move on to the next
    //  step in the flow
    if ( cacheEntry != null && totalNumberOfParallelDelegatesProcessingCas > 1 && ( cacheEntry.howManyDelegatesResponded() < totalNumberOfParallelDelegatesProcessingCas))
    {
      synchronized( cacheEntry )
      {
        cacheEntry.incrementHowManyDelegatesResponded();
      }
    }

    if (aController instanceof AggregateAnalysisEngineController && t instanceof Exception)
    {
      boolean flowControllerContinueFlag = false;
      // if the deployment descriptor says no retries, dont care what the Flow Controller says
      if ( threshold != null && threshold.getContinueOnRetryFailure() )
      {
        try
        {
          //  Consult Flow Controller to determine if it is ok to continue despite the error
          flowControllerContinueFlag =
View Full Code Here

Examples of org.apache.uima.aae.error.Threshold

        UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", t);

    Endpoint endpoint = (Endpoint) anErrorContext.get(AsynchAEMessage.Endpoint);
    if ( endpoint != null )
    {
      Threshold threshold = null;
      if ( aController instanceof PrimitiveAnalysisEngineController )
      {
        threshold = (Threshold)delegateMap.get("");
      }
      else
      {
        threshold = super.getThreshold(endpoint, delegateMap, aController);
      }
      try
      {
        if ( aController instanceof AggregateAnalysisEngineController )
        {
          endpoint = ((AggregateAnalysisEngineController)aController).getClientEndpoint();
        }
        aController.getOutputChannel().sendReply(t, null, endpoint, AsynchAEMessage.CollectionProcessComplete);
      }
      catch( Exception e)
      {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, getClass().getName(), "handleError",
            UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", e);
      }

      if ( threshold != null && threshold.getAction().equalsIgnoreCase(ErrorHandler.TERMINATE ))
        {
        aController.takeAction(threshold.getAction(), endpoint.getEndpoint(), anErrorContext);
        }
        else if ( threshold == null )
        {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, getClass().getName(), "handleError", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_no_threshold_for_endpoint__CONFIG", new Object[] { aController.getName(), "Collection Processing Complete",  aController.getName() });
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.