private void updateNormalMetrics(int writeCount) { int readCount = currentChunkStatus.getItemsTouchedInCurrentChunk(); int filterCount = readCount - writeCount; if (readCount < 0 || filterCount < 0 || writeCount < 0) { throw new IllegalStateException("Somehow one of the metrics was zero. Read count: " + readCount + ", Filter count: " + filterCount + ", Write count: " + writeCount); } runtimeStepExecution.getMetric(MetricImpl.MetricType.COMMIT_COUNT).incValue(); runtimeStepExecution.getMetric(MetricImpl.MetricType.READ_COUNT).incValueBy(readCount); runtimeStepExecution.getMetric(MetricImpl.MetricType.FILTER_COUNT).incValueBy(filterCount); runtimeStepExecution.getMetric(MetricImpl.MetricType.WRITE_COUNT).incValueBy(writeCount); }
@Override public Metric[] getMetrics() { Metric[] metrics = new MetricImpl[8]; metrics[0] = new MetricImpl(MetricImpl.MetricType.READ_COUNT, readCount); metrics[1] = new MetricImpl(MetricImpl.MetricType.WRITE_COUNT, writeCount); metrics[2] = new MetricImpl(MetricImpl.MetricType.COMMIT_COUNT, commitCount); metrics[3] = new MetricImpl(MetricImpl.MetricType.ROLLBACK_COUNT, rollbackCount); metrics[4] = new MetricImpl(MetricImpl.MetricType.READ_SKIP_COUNT, readSkipCount); metrics[5] = new MetricImpl(MetricImpl.MetricType.PROCESS_SKIP_COUNT, processSkipCount); metrics[6] = new MetricImpl(MetricImpl.MetricType.FILTER_COUNT, filterCount); metrics[7] = new MetricImpl(MetricImpl.MetricType.WRITE_SKIP_COUNT, writeSkipCount); return metrics; }
/** * Creates/Updates the committedMetrics variable using the passed in metric types */ public void setCommittedMetrics() { for (MetricImpl.MetricType metricType : this.tranCoordinatedMetricTypes) { committedMetrics.put(metricType.name(), new MetricImpl(metricType, this.getMetric(metricType).getValue())); } }
private void incrementMetrics() { rse.getMetric(MetricImpl.MetricType.READ_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.WRITE_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.FILTER_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.COMMIT_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.PROCESS_SKIP_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValue(); rse.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); }
runtimeStepExecution.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValueBy(1); } else { throw new BatchContainerRuntimeException(e); runtimeStepExecution.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValueBy(1); } else if (retryWriteException(e, theChunk)) { if (!retryHandler.isRollbackException(e)) {
assertEquals( 0, rse.getMetric(committedMetricTypes.get(i)).getValue()); assertEquals( 3, rse.getMetric(otherMetricTypes.get(i)).getValue()); rse.rollBackMetrics(); for (int i = 0; i < committedMetricTypes.size(); i++){ assertEquals( 1, rse.getMetric(committedMetricTypes.get(i)).getValue()); assertEquals( 4, rse.getMetric(otherMetricTypes.get(i)).getValue());
private void rollbackAfterRetryableException() { writerProxy.close(); readerProxy.close(); callChunkListenerOnError(currentChunkStatus.getRetryableException()); transactionManager.rollback(); stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); }
stepContext.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValueBy(1); } else { throw new BatchContainerRuntimeException(e); stepContext.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValueBy(1); } else if (retryWriteException(e, theChunk)) { if (!retryHandler.isRollbackException(e)) {
stepContext.getMetric(MetricImpl.MetricType.FILTER_COUNT).incValue(); status.setFiltered(true); if (processedItem == null) { stepContext.getMetric(MetricImpl.MetricType.FILTER_COUNT).incValue(); status.setFiltered(true); rollbackRetry = true; stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); stepContext.getMetric(MetricImpl.MetricType.PROCESS_SKIP_COUNT).incValue(); if (skipProcessException(e, itemRead)) { status.setSkipped(true); stepContext.getMetric(MetricImpl.MetricType.PROCESS_SKIP_COUNT).incValue(); } else if (retryProcessException(e, itemRead)) { if (!retryHandler.isRollbackException(e)) { if (processedItem == null) { stepContext.getMetric(MetricImpl.MetricType.FILTER_COUNT).incValue(); status.setFiltered(true); rollbackRetry = true; stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue();
private void updateNormalMetrics(int writeCount) { int readCount = currentChunkStatus.getItemsTouchedInCurrentChunk(); int filterCount = readCount - writeCount; if (readCount < 0 || filterCount < 0 || writeCount < 0) { throw new IllegalStateException("Somehow one of the metrics was zero. Read count: " + readCount + ", Filter count: " + filterCount + ", Write count: " + writeCount); } stepContext.getMetric(MetricImpl.MetricType.COMMIT_COUNT).incValue(); stepContext.getMetric(MetricImpl.MetricType.READ_COUNT).incValueBy(readCount); stepContext.getMetric(MetricImpl.MetricType.FILTER_COUNT).incValueBy(filterCount); stepContext.getMetric(MetricImpl.MetricType.WRITE_COUNT).incValueBy(writeCount); }
@Override public Metric[] getMetrics() { if (stepContext != null) { return stepContext.getMetrics(); } else { Metric[] metrics = new MetricImpl[8]; metrics[0] = new MetricImpl(MetricImpl.MetricType.READ_COUNT, readCount); metrics[1] = new MetricImpl(MetricImpl.MetricType.WRITE_COUNT, writeCount); metrics[2] = new MetricImpl(MetricImpl.MetricType.COMMIT_COUNT, commitCount); metrics[3] = new MetricImpl(MetricImpl.MetricType.ROLLBACK_COUNT, rollbackCount); metrics[4] = new MetricImpl(MetricImpl.MetricType.READ_SKIP_COUNT, readSkipCount); metrics[5] = new MetricImpl(MetricImpl.MetricType.PROCESS_SKIP_COUNT, processSkipCount); metrics[6] = new MetricImpl(MetricImpl.MetricType.FILTER_COUNT, filterCount); metrics[7] = new MetricImpl(MetricImpl.MetricType.WRITE_SKIP_COUNT, writeSkipCount); return metrics; } }
public void rollBackMetrics(){ for (MetricImpl.MetricType metricType : this.tranCoordinatedMetricTypes) { metrics.put(metricType.name(), new MetricImpl(metricType, this.getCommittedMetric(metricType).getValue())); } }
private void rollbackAfterRetryableException(int currentChunk) { JoblogUtil.logToJobLogAndTraceOnly(Level.FINE, "chunk.rollback.and.retry", new Object[] { runtimeStepExecution.getStepName(), getJobInstanceId(), getJobExecutionId(), runtimeStepExecution.getMetrics() }, logger); writerProxy.close(); readerProxy.close(); callChunkListenerOnError(currentChunkStatus.getRetryableException()); getTransactionManager().rollback(); runtimeStepExecution.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); }
writeListenerProxy.afterWrite(theChunk); stepContext.getMetric(MetricImpl.MetricType.WRITE_COUNT).incValueBy(theChunk.size()); } catch (Exception e) { this.stepContext.setException(e); status.setRollback(true); stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); stepContext.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValueBy(1); } else { throw new BatchContainerRuntimeException(e); stepContext.getMetric(MetricImpl.MetricType.WRITE_SKIP_COUNT).incValueBy(1); } else if (retryWriteException(e, theChunk)) { if (!retryHandler.isRollbackException(e)) { status.setRollback(true); stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue();
@Override public Metric[] getMetrics() { if (stepContext != null){ return stepContext.getMetrics(); } else { Metric[] metrics = new MetricImpl[8]; metrics[0] = new MetricImpl(MetricImpl.MetricType.READ_COUNT, readCount); metrics[1] = new MetricImpl(MetricImpl.MetricType.WRITE_COUNT, writeCount); metrics[2] = new MetricImpl(MetricImpl.MetricType.COMMIT_COUNT, commitCount); metrics[3] = new MetricImpl(MetricImpl.MetricType.ROLLBACK_COUNT, rollbackCount); metrics[4] = new MetricImpl(MetricImpl.MetricType.READ_SKIP_COUNT, readSkipCount); metrics[5] = new MetricImpl(MetricImpl.MetricType.PROCESS_SKIP_COUNT, processSkipCount); metrics[6] = new MetricImpl(MetricImpl.MetricType.FILTER_COUNT, filterCount); metrics[7] = new MetricImpl(MetricImpl.MetricType.WRITE_SKIP_COUNT, writeSkipCount); return metrics; } }
stepContext.getMetric(MetricImpl.MetricType.READ_COUNT).incValue(); rollbackRetry = true; stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue(); stepContext.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue(); stepContext.getMetric(MetricImpl.MetricType.READ_SKIP_COUNT).incValue(); status.setRollback(true); stepContext.getMetric(MetricImpl.MetricType.ROLLBACK_COUNT).incValue();
public void addMetric(MetricImpl.MetricType metricType, long value) { metrics.putIfAbsent(metricType.name(), new MetricImpl(metricType, value)); }
public void addMetric(MetricImpl.MetricType metricType, long value) { metrics.putIfAbsent(metricType.name(), new MetricImpl(metricType, value)); }