/**
  * Called when the SOAP trigger ends.
  *
  * @param startTime Trigger time from the onTriggerStart() method.
  */
 public void onTriggerEnd(long startTime) {
   try {
     if (initialized) {
       triggerTime.finish(startTime);
     }
   } catch (Exception e) {
     LOG.log(Severity.WARN, "Error while updating a JMX counter.", e);
   }
 }
 /**
  * Called when the SOAP trigger starts.
  *
  * @return Returns the trigger start time. This must be passed to the finish method.
  */
 public long onTriggerStart() {
   try {
     if (initialized) {
       return triggerTime.start();
     } else {
       return -1;
     }
   } catch (Exception e) {
     LOG.log(Severity.WARN, "Error while updating a JMX counter.", e);
     return -1;
   }
 }
  /**
   * Called when the file processing starts.
   *
   * @param size File size.
   * @return Returns the processing start time. This must be passed to the finish method.
   */
  public long onProcessingStart(long size) {
    try {
      if (initialized) {
        long t = processingTime.start();

        fileSize.addEvent((int) size);

        return t;
      } else {
        return -1;
      }
    } catch (Exception e) {
      LOG.log(Severity.WARN, "Error while updating a JMX counter.", e);
      return -1;
    }
  }
  /**
   * Called when the file processing ends.
   *
   * @param success <code>true</code> if the processing succeeded.
   * @param startTime Processing start time from the onProcessingStart() method.
   */
  public void onProcessingEnd(boolean success, long startTime) {
    try {
      if (initialized) {
        if (success) {
          successfulFileCount.addEvent();
        } else {
          errorFileCount.addEvent();
        }

        totalFileCount.addEvent();
        processingTime.finish(startTime);
      }
    } catch (Exception e) {
      LOG.log(Severity.WARN, "Error while updating a JMX counter.", e);
    }
  }