class SimpleExecutionRunnable implements Runnable {

    @Override
    public void run() {
        String executionId = executionMessage.getMsgId();

        // We are renaming the thread for logging/monitoring purposes
        String origThreadName = currentThread().getName();
        currentThread().setName(origThreadName + "_" + executionId);
        Execution execution = null;
        try {
            // If we got here because of te shortcut we have the object
            // If we got here form DB - we need to extract the object from bytes
            execution = (executionMessage.getExecutionObject() != null) ? executionMessage.getExecutionObject()
                    : converter.extractExecution(executionMessage.getPayload());

            // Check which logic to trigger - regular execution or split
            if (executionService.isSplitStep(execution)) {
                executeSplitStep(execution);
            } else {
                executeRegularStep(execution);
            }
        } catch (InterruptedException interruptedException) {

            // Not old thread and interrupted by cancel
            if (workerManager.isFromCurrentThreadPool(currentThread().getName()) && isExecutionCancelled(execution)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Execution is interrupted...");
                }
            } else {
                logger.error("Execution thread is interrupted!!! Exiting...", interruptedException);
            }
        } catch (Exception ex) {
            logger.error("Error during execution!!!", ex);
            // Set status FAILED
            executionMessage.setStatus(ExecStatus.FAILED);
            executionMessage
                    .incMsgSeqId();    // New status must be with incremented msg_seq_id - otherwise will be recovered and we will get duplications
            // Send only one execution message back - the new one was not created because of error
            try {
                if (executionMessage.getPayload() == null) {
                    // This is done since we could get here from InBuffer shortcut - so no payload... and for FAILED message we need to set the payload
                    executionMessage.setPayload(converter.createPayload(execution));
                }
                outBuffer.put(executionMessage);
            } catch (InterruptedException e) {
                logger.warn("Thread was interrupted! Exiting the execution... ", ex);
            }
        } finally {
            endExecutionCallback.endExecution(parseLong(executionId));
            // Rename the thread back
            currentThread().setName(origThreadName);
        }
    }

    public  SimpleExecutionRunnable(ExecutionService executionService,
                                   OutboundBuffer outBuffer,
                                   InBuffer inBuffer,
                                   ExecutionMessageConverter converter,
                                   EndExecutionCallback endExecutionCallback,
                                   QueueStateIdGeneratorService queueStateIdGeneratorService,
                                   String workerUUID,
                                   WorkerConfigurationService workerConfigurationService,
                                   WorkerManager workerManager);

}