Example usage for javax.resource.spi.work WorkEvent getWork

List of usage examples for javax.resource.spi.work WorkEvent getWork

Introduction

In this page you can find the example usage for javax.resource.spi.work WorkEvent getWork.

Prototype

public Work getWork() 

Source Link

Document

Return the Work instance which is the cause of the event.

Usage

From source file:org.mule.processor.AsyncWorkListener.java

protected void handleWorkException(WorkEvent event, String type) {
    if (event == null) {
        return;//from w ww  . jav  a  2 s  . c  om
    }

    Throwable e = event.getException();

    if (e == null) {
        return;
    }

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

    logger.error(
            "Work caused exception on '" + type + "'. Work being executed was: " + event.getWork().toString());
    throw new MuleRuntimeException(CoreMessages.errorInvokingMessageProcessorAsynchronously(target), e);
}

From source file:org.mule.transport.AbstractConnector.java

protected void handleWorkException(WorkEvent event, String type) {
    if (event == null) {
        return;//from ww w . ja va2  s . c  o  m
    }

    Throwable e = event.getException();

    if (e == null) {
        return;
    }

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

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

    if (e instanceof MessagingException) {
        MuleEvent failedEvent = ((MessagingException) e).getEvent();
        failedEvent.getFlowConstruct().getExceptionListener().handleException((MessagingException) e,
                failedEvent);
    } else if (e instanceof Exception) {
        muleContext.getExceptionListener().handleException((Exception) e);
    } else {
        muleContext.getExceptionListener().handleException(
                new MuleRuntimeException(CoreMessages.connectorCausedError(this.getName()), e));
    }
}

From source file:org.mule.work.DefaultWorkListener.java

protected void handleWorkException(WorkEvent event, String type) {
    Throwable e;/*from w ww  . j  av a  2  s  . c  o  m*/

    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());
    logger.error(e);
}