Examples of CasProcessorErrorHandling


Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

    if (getCasProcessorFilter() == null) {
      CasProcessorFilter filter = CpeDescriptorFactory.produceCasProcessorFilter("");
      setCasProcessorFilter(filter);
    }
    if (getErrorHandling() == null) {
      CasProcessorErrorHandling errorHandling = CpeDescriptorFactory
              .produceCasProcessorErrorHandling();
      CasProcessorMaxRestarts maxRestart = CpeDescriptorFactory.produceCasProcessorMaxRestarts();
      maxRestart.setRestartCount(30);
      maxRestart.setAction("terminate");
      errorHandling.setMaxConsecutiveRestarts(maxRestart);
      CasProcessorTimeout timeout = CpeDescriptorFactory.produceCasProcessorTimeout();
      timeout.set(100000);
      errorHandling.setTimeout(timeout);
      CasProcessorErrorRateThreshold errorThreshold = CpeDescriptorFactory
              .produceCasProcessorErrorRateThreshold();
      errorThreshold.setMaxErrorCount(100);
      errorThreshold.setMaxErrorSampleSize(1000);
      errorThreshold.setAction("terminate");
      errorHandling.setErrorRateThreshold(errorThreshold);
      setErrorHandling(errorHandling);
    }
    if (getCheckpoint() == null) {
      CpeCheckpoint checkpoint = CpeDescriptorFactory.produceCpeCheckpoint();
      checkpoint.setBatchSize(1);
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   *
   * @param aErrorCount -
   *          max error tolerance
   */
  public void setMaxErrorCount(int aErrorCount) {
    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getErrorRateThreshold() != null) {
      eh.getErrorRateThreshold().setMaxErrorCount(aErrorCount);
    }
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   * @param aErrorCount -
   *          max error tolerance
   */
  public int getMaxErrorCount() {

    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getErrorRateThreshold() != null) {
      return eh.getErrorRateThreshold().getMaxErrorCount();
    }

    return 0;
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   * @param aErrorCount -
   *          max error tolerance
   */
  public void setMaxErrorSampleSize(int aErrorSampleSize) {

    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getErrorRateThreshold() != null) {
      eh.getErrorRateThreshold().setMaxErrorSampleSize(aErrorSampleSize);
    }

  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   * 3/1000, which means 3 errors per thousand.
   *
   * @return - the sample size
   */
  public int getMaxErrorSampleSize() {
    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getErrorRateThreshold() != null) {
      return eh.getErrorRateThreshold().getMaxErrorSampleSize();
    }

    return 0;
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   *
   * @param aAction -
   *          action string
   */
  public void setActionOnMaxError(String aAction) {
    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getErrorRateThreshold() != null) {
      eh.getErrorRateThreshold().setAction(aAction);
    }
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   * Return action associated with CasProcessor error tolerance.
   *
   * @return - action as string ( terminate, continue, disable), null when not defined
   */
  public String getActionOnMaxError() {
    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getErrorRateThreshold() != null) {
      return eh.getErrorRateThreshold().getAction();
    }
    return null;
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   *
   * @param aAction -
   *          action string
   */
  public void setActionOnMaxRestart(String aAction) {
    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getMaxConsecutiveRestarts() != null) {
      eh.getMaxConsecutiveRestarts().setAction(aAction);
    }
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   * Return action associated with CasProcessor restart tolerance.
   *
   * @return - action as string ( terminate, continue, disable), null when not defined
   */
  public String getActionOnMaxRestart() {
    CasProcessorErrorHandling eh = getErrorHandling();
    if (eh != null && eh.getMaxConsecutiveRestarts() != null) {
      return eh.getMaxConsecutiveRestarts().getAction();
    }
    return null;
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorErrorHandling

   * @param aJaxbCasProcessorConfig -
   *          configuration object containing Cas Processor configuration
   */
  private void addErrorHandling(CpeCasProcessor aCasProcessorConfig)
          throws ResourceConfigurationException {
    CasProcessorErrorHandling casProcessorErrorHandling = aCasProcessorConfig.getErrorHandling();

    if (casProcessorErrorHandling == null) {
      throw new ResourceConfigurationException(InvalidXMLException.ELEMENT_NOT_FOUND, new Object[] {
          "errorHandling", "casProcessor" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
              CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_missing_xml_element__WARNING",
              new Object[] { Thread.currentThread().getName(), name, "<errorHandling>" })));
    }
    CasProcessorMaxRestarts maxRestarts = casProcessorErrorHandling.getMaxConsecutiveRestarts();
    if (maxRestarts == null) {
      throw new ResourceConfigurationException(
              ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] {
                  "maxConsecutiveRestarts", "CPE" }, new Exception(CpmLocalizedMessage
                      .getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                              "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
                                  Thread.currentThread().getName(), name,
                                  "<maxConsecutiveRestarts>" })));
    }
    maxRetryThreshold = maxRestarts.getRestartCount();
    waitTimeBetweenRestarts = maxRestarts.getWaitTimeBetweenRetries();

    maxRestartThreshold = maxRestarts.getRestartCount();

    if (!validActionOnError(maxRestarts.getAction())) {
      throw new ResourceConfigurationException(
              ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] { "action",
                  "CPE" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
                      CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_action_string__WARNING",
                      new Object[] { Thread.currentThread().getName(), name,
                          "<maxConsecutiveRestarts>", maxRestarts.getAction() })));
    }
    actionOnMaxRestarts = maxRestarts.getAction();

    // Setup Error rate Threshold in terms of (count)/(sample size) eg. 3/1000
    CasProcessorErrorRateThreshold errorRateThresholdType = casProcessorErrorHandling
            .getErrorRateThreshold();
    if (errorRateThresholdType == null) {
      throw new ResourceConfigurationException(
              ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] {
                  "errorRateThreshold", "CPE" },
              new Exception(CpmLocalizedMessage.getLocalizedMessage(
                      CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                      "UIMA_CPM_EXP_missing_xml_element__WARNING", new Object[] {
                          Thread.currentThread().getName(), name, "<errorRateThreshold>" })));
    }

    errorRate = errorRateThresholdType.getMaxErrorCount();
    errorSampleSize = errorRateThresholdType.getMaxErrorSampleSize();

    if (!validActionOnError(errorRateThresholdType.getAction())) {
      throw new ResourceConfigurationException(
              ResourceConfigurationException.MANDATORY_VALUE_MISSING, new Object[] { "action",
                  "CPE" }, new Exception(CpmLocalizedMessage.getLocalizedMessage(
                      CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_bad_action_string__WARNING",
                      new Object[] { Thread.currentThread().getName(), name,
                          "<errorRateThreshold>", maxRestarts.getAction() })));

    }
    actionOnMaxError = errorRateThresholdType.getAction();

    CasProcessorTimeout timeoutType = casProcessorErrorHandling.getTimeout();
    timeOut = timeoutType.get();

  }
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.