Package javax.batch.operations

Examples of javax.batch.operations.BatchRuntimeException


    private int failWriteAt;

    @Override
    public void open(final Serializable checkpoint) throws Exception {
        if (failWriterAtOpen) {
            throw new BatchRuntimeException("Failed writer at open");
        }
        ReaderWriterResult.getOrCreateReaderWriterItem(stepContext).setWriterClosed(false);
    }
View Full Code Here


    @Override
    public void writeItems(final List<Object> items) throws Exception {
        final ReaderWriterResult item = ReaderWriterResult.getOrCreateReaderWriterItem(stepContext);
        for (Object o : items) {
            if (item.incrementWriteCount() == failWriteAt) {
                throw new BatchRuntimeException("Failed writer at point " + failWriteAt + ". Reader and writer should both be closed.");
            }
        }
    }
View Full Code Here

   
    @Override
    public void beforeStep() throws Exception {
        SleepBatchlet.appendJobExitStatus(jobContext, "beforeStep");
        if (failBeforeStep) {
            throw new BatchRuntimeException("failBeforeStep is set to " + failBeforeStep);
        }
        System.out.println("In beforeStep method of " + this);
    }
View Full Code Here

    @Override
    public void afterStep() throws Exception {
        SleepBatchlet.appendJobExitStatus(jobContext, "afterStep");
        if (failAfterStep) {
            throw new BatchRuntimeException("failAfterStep is set to " + failAfterStep);
        }
        System.out.println("In afterStep method of " + this);
    }
View Full Code Here

            } catch (final Throwable e) {
                LOGGER.failToRunJob(e, jobContext.getJobName(), step.getId(), step);
                if (e instanceof Exception) {
                    batchContext.setException((Exception) e);
                } else {
                    batchContext.setException(new BatchRuntimeException(e));
                }
                batchContext.setBatchStatus(BatchStatus.FAILED);
            }

            jobContext.destroyArtifact(mapper, reducer, analyzer);
View Full Code Here

    @Override
    public void beforeJob() throws Exception {
        SleepBatchlet.appendJobExitStatus(jobContext, "beforeJob");
        if (failBeforeJob) {
            throw new BatchRuntimeException("failBeforeJob is set to " + failBeforeJob);
        }
        System.out.printf("In beforeJob method of %s%n", this);
    }
View Full Code Here

    @Override
    public void afterJob() throws Exception {
        SleepBatchlet.appendJobExitStatus(jobContext, "afterJob");
        if (failAfterJob) {
            throw new BatchRuntimeException("failAfterJob is set to " + failAfterJob);
        }
        System.out.printf("In afterJob method of %s%n", this);
    }
View Full Code Here

    @Override
    public String process() throws Exception {
        processThread = Thread.currentThread();
        if (failInProcess) {
            throw new BatchRuntimeException("failInProcess is set to true");
        }

        try {
            Thread.sleep(sleepMinutes * 60 * 1000);
        } catch (final InterruptedException e) {
View Full Code Here

                } catch (Throwable e) {
                    LOGGER.failToRunJob(e, jobContext.getJobName(), step.getId(), step);
                    if (e instanceof Exception) {
                        batchContext.setException((Exception) e);
                    } else {
                        batchContext.setException(new BatchRuntimeException(e));
                    }
                    batchContext.setBatchStatus(BatchStatus.FAILED);
                }

                jobContext.destroyArtifact(mapper, reducer, analyzer);
View Full Code Here

TOP

Related Classes of javax.batch.operations.BatchRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.