Example usage for javax.resource.spi.work WorkCompletedException setErrorCode

List of usage examples for javax.resource.spi.work WorkCompletedException setErrorCode

Introduction

In this page you can find the example usage for javax.resource.spi.work WorkCompletedException setErrorCode.

Prototype

public void setErrorCode(String errorCode) 

Source Link

Document

Set the error code.

Usage

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

/**
 * Execute the specified Work.// w  ww . ja v  a2 s  . com
 *
 * @param work Work to be executed.
 * @exception WorkException Indicates that the Work execution has been
 *                unsuccessful.
 */
private void executeWork(WorkerContext work, WorkExecutor workExecutor) throws WorkException {
    if (!isStarted()) {
        throw new IllegalStateException("This MuleWorkManager '" + name + "' is stopped");
    }

    try {
        work.workAccepted(this);
        workExecutor.doExecute(work, workExecutorService);
        WorkException exception = work.getWorkException();
        if (null != exception) {
            throw exception;
        }
    } catch (InterruptedException e) {
        WorkCompletedException wcj = new WorkCompletedException(
                "The execution has been interrupted for WorkManager: " + name, e);
        wcj.setErrorCode(WorkException.INTERNAL);
        throw wcj;
    }
}