Пример #1
0
  protected void handleWorkException(WorkEvent event, String type) {
    Throwable e;

    if (event != null && event.getException() != null) {
      e = event.getException();
    } else {
      return;
    }

    if (event.getException().getCause() != null) {
      e = event.getException().getCause();
    }

    logger.error(
        "Work caused exception on '"
            + type
            + "'. Work being executed was: "
            + event.getWork().toString());

    if (e instanceof Exception) {
      handleException((Exception) e);
    } else {
      throw new MuleRuntimeException(CoreMessages.componentCausedErrorIs(this.getName()), e);
    }
  }
Пример #2
0
  /**
   * accept work
   *
   * @param e workEvent
   */
  @Override
  public void workAccepted(WorkEvent e) {
    if (e.getType() != WorkEvent.WORK_ACCEPTED) fail("Wrong accepted type");
    source = e.getSource();
    work = e.getWork();
    startDuration = e.getStartDuration();
    exception = e.getException();

    if (callbackCount != null) {
      synchronized (this) {
        callbackCount.setAcceptCount(callbackCount.getAcceptCount() + 1);
      }
    }

    super.workAccepted(e);
  }
Пример #3
0
  /**
   * start work
   *
   * @param e workEvent
   */
  @Override
  public void workStarted(WorkEvent e) {
    if (e.getType() != WorkEvent.WORK_STARTED) fail("Wrong started type");

    if (callbackCount != null) {
      synchronized (this) {
        callbackCount.setStartCount(callbackCount.getStartCount() + 1);
      }
    }

    super.workStarted(e);
  }
Пример #4
0
  /**
   * complete work
   *
   * @param e workEvent
   */
  @Override
  public void workCompleted(WorkEvent e) {
    if (e.getType() != WorkEvent.WORK_COMPLETED) fail("Wrong completed type");

    if (callbackCount != null) {
      synchronized (this) {
        callbackCount.setCompletedCount(callbackCount.getCompletedCount() + 1);
      }
    }

    super.workCompleted(e);
  }