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); } }
/** * 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); }