Editing pass for Javadocs
Update javadocs of org.springframework.batch.core but not further down that tree. Issue #4090
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
6dad2a2d81
commit
d00cd947ca
@@ -17,8 +17,8 @@
|
||||
package org.springframework.batch.core;
|
||||
|
||||
/**
|
||||
* Enumeration representing the status of an Execution.
|
||||
*
|
||||
* Enumeration representing the status of an execution.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
@@ -28,14 +28,14 @@ public enum BatchStatus {
|
||||
|
||||
/**
|
||||
* The order of the status values is significant because it can be used to
|
||||
* aggregate a set of status values - the result should be the maximum
|
||||
* value. Since COMPLETED is first in the order, only if all elements of an
|
||||
* execution are COMPLETED will the aggregate status be COMPLETED. A running
|
||||
* execution is expected to move from STARTING to STARTED to COMPLETED
|
||||
* aggregate a set of status values. The result should be the maximum
|
||||
* value. Since {@code COMPLETED} is first in the order, only if all elements of an
|
||||
* execution are {@code COMPLETED} can the aggregate status be COMPLETED. A running
|
||||
* execution is expected to move from {@code STARTING} to {@code STARTED} to {@code COMPLETED}
|
||||
* (through the order defined by {@link #upgradeTo(BatchStatus)}). Higher
|
||||
* values than STARTED signify more serious failure. ABANDONED is used for
|
||||
* steps that have finished processing, but were not successful, and where
|
||||
* they should be skipped on a restart (so FAILED is the wrong status).
|
||||
* values than {@code STARTED} signify more serious failures. {@code ABANDONED} is used for
|
||||
* steps that have finished processing but were not successful and where
|
||||
* they should be skipped on a restart (so {@code FAILED} is the wrong status).
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ public enum BatchStatus {
|
||||
UNKNOWN;
|
||||
|
||||
/**
|
||||
* Convenience method to return the higher value status of the statuses pass in to the method.
|
||||
* Convenience method to return the higher value status of the statuses passed to the method.
|
||||
*
|
||||
* @param status1 The first status to check.
|
||||
* @param status2 The second status to check.
|
||||
@@ -83,8 +83,8 @@ public enum BatchStatus {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to decide if a status indicates work is in progress.
|
||||
*
|
||||
* Convenience method to decide if a status indicates that work is in progress.
|
||||
*
|
||||
* @return true if the status is STARTING, STARTED
|
||||
*/
|
||||
public boolean isRunning() {
|
||||
@@ -94,8 +94,8 @@ public enum BatchStatus {
|
||||
/**
|
||||
* Convenience method to decide if a status indicates execution was
|
||||
* unsuccessful.
|
||||
*
|
||||
* @return true if the status is FAILED or greater
|
||||
*
|
||||
* @return {@code true} if the status is {@code FAILED} or greater.
|
||||
*/
|
||||
public boolean isUnsuccessful() {
|
||||
return this == FAILED || this.isGreaterThan(FAILED);
|
||||
@@ -104,13 +104,13 @@ public enum BatchStatus {
|
||||
/**
|
||||
* Method used to move status values through their logical progression, and
|
||||
* override less severe failures with more severe ones. This value is
|
||||
* compared with the parameter and the one that has higher priority is
|
||||
* returned. If both are STARTED or less than the value returned is the
|
||||
* largest in the sequence STARTING, STARTED, COMPLETED. Otherwise the value
|
||||
* compared with the parameter, and the one that has higher priority is
|
||||
* returned. If both are {@code STARTED} or less than the value returned is the
|
||||
* largest in the sequence {@code STARTING}, {@code STARTED}, {@code COMPLETED}. Otherwise, the value
|
||||
* returned is the maximum of the two.
|
||||
*
|
||||
* @param other another status to compare to
|
||||
* @return either this or the other status depending on their priority
|
||||
*
|
||||
* @param other Another status to which to compare.
|
||||
* @return either this or the other status, depending on their priority.
|
||||
*/
|
||||
public BatchStatus upgradeTo(BatchStatus other) {
|
||||
if (isGreaterThan(STARTED) || other.isGreaterThan(STARTED)) {
|
||||
@@ -124,36 +124,36 @@ public enum BatchStatus {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other a status value to compare
|
||||
* @return true if this is greater than other
|
||||
* @param other A status value to which to compare.
|
||||
* @return {@code true} if this is greater than {@code other}.
|
||||
*/
|
||||
public boolean isGreaterThan(BatchStatus other) {
|
||||
return this.compareTo(other) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other a status value to compare
|
||||
* @return true if this is less than other
|
||||
* @param other A status value to which to compare.
|
||||
* @return {@code true} if this is less than {@code other}.
|
||||
*/
|
||||
public boolean isLessThan(BatchStatus other) {
|
||||
return this.compareTo(other) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other a status value to compare
|
||||
* @return true if this is less than other
|
||||
* @param other A status value to which to compare.
|
||||
* @return {@code true} if this is less than {@code other}.
|
||||
*/
|
||||
public boolean isLessThanOrEqualTo(BatchStatus other) {
|
||||
return this.compareTo(other) <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a BatchStatus that matches the beginning of the given value. If no
|
||||
* match is found, return COMPLETED as the default because has is low
|
||||
* Find a {@code BatchStatus} that matches the beginning of the given value. If no
|
||||
* match is found, return {@code COMPLETED} as the default because it has low
|
||||
* precedence.
|
||||
*
|
||||
* @param value a string representing a status
|
||||
* @return a BatchStatus
|
||||
*
|
||||
* @param value A string representing a status.
|
||||
* @return a {BatchStatus} object.
|
||||
*/
|
||||
public static BatchStatus match(String value) {
|
||||
for (BatchStatus status : values()) {
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.springframework.batch.core;
|
||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
|
||||
/**
|
||||
* Listener interface for the lifecycle of a chunk. A chunk
|
||||
* can be thought of as a collection of items that will be
|
||||
* Listener interface for the lifecycle of a chunk. A chunk
|
||||
* can be thought of as a collection of items that are
|
||||
* committed together.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
@@ -52,11 +52,11 @@ public interface ChunkListener extends StepListener {
|
||||
|
||||
/**
|
||||
* Callback after a chunk has been marked for rollback. It is invoked
|
||||
* after transaction rollback. While the rollback will have occurred,
|
||||
* transactional resources might still be active and accessible. Due to
|
||||
* this, data access code within this callback will still "participate" in
|
||||
* after transaction rollback. While the rollback will have occurred,
|
||||
* transactional resources might still be active and accessible. Due to
|
||||
* this, data access code within this callback still "participates" in
|
||||
* the original transaction unless it declares that it runs in its own
|
||||
* transaction. Hence: <em> Use PROPAGATION_REQUIRES_NEW for any
|
||||
* transaction. <em>As a result, you should use {@code PROPAGATION_REQUIRES_NEW} for any
|
||||
* transactional operation that is called from here.</em>
|
||||
*
|
||||
* @param context the chunk context containing the exception that caused
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,8 +26,8 @@ import org.springframework.util.DigestUtils;
|
||||
|
||||
/**
|
||||
* Default implementation of the {@link JobKeyGenerator} interface.
|
||||
* This implementation provides a single hash value based on the JobParameters
|
||||
* passed in. Only identifying parameters (per {@link JobParameter#isIdentifying()})
|
||||
* This implementation provides a single hash value based on the {@link JobParameters} object
|
||||
* passed in. Only identifying parameters (as per {@link JobParameter#isIdentifying()})
|
||||
* are used in the calculation of the key.
|
||||
*
|
||||
* @author Michael Minella
|
||||
|
||||
@@ -22,9 +22,9 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Batch Domain Entity class. Any class that should be uniquely identifiable
|
||||
* from another should subclass from Entity. More information on this pattern
|
||||
* and the difference between Entities and Value Objects can be found in Domain
|
||||
* Driven Design by Eric Evans.
|
||||
* from another should subclass from Entity. See Domain
|
||||
* Driven Design, by Eric Evans, for more information on this pattern
|
||||
* and the difference between Entities and Value Objects.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
@@ -75,22 +75,22 @@ public class Entity implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the version
|
||||
* @return the version.
|
||||
*/
|
||||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the version needed only by repository methods.
|
||||
* @param version the version to set
|
||||
* Public setter for the version. Needed only by repository methods.
|
||||
* @param version The version to set.
|
||||
*/
|
||||
public void setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the version number
|
||||
* Increment the version number.
|
||||
*/
|
||||
public void incrementVersion() {
|
||||
if (version == null) {
|
||||
@@ -100,14 +100,18 @@ public class Entity implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string representation of the {@code Entity},
|
||||
* including the {@code id}, {@code version}, and class name.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s: id=%d, version=%d", ClassUtils.getShortName(getClass()), id, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to establish identity based on id if both exist. If either id
|
||||
* does not exist use Object.equals().
|
||||
* Attempt to establish identity based on {@code id} if both exist. If either {@code id}
|
||||
* does not exist, use {@code Object.equals()}.
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@@ -130,13 +134,14 @@ public class Entity implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Use ID if it exists to establish hash code, otherwise fall back to
|
||||
* Object.hashCode(). Based on the same information as equals, so if that
|
||||
* changes, this will. N.B. this follows the contract of Object.hashCode(),
|
||||
* Use {@code id}, if it exists, to establish a hash code. Otherwise fall back to
|
||||
* {@code Object.hashCode()}. It is based on the
|
||||
* same information as {@code equals}, so, if that
|
||||
* changes, this will. Note that this follows the contract of {@code Object.hashCode()}
|
||||
* but will cause problems for anyone adding an unsaved {@link Entity} to a
|
||||
* Set because Set.contains() will almost certainly return false for the
|
||||
* {@code Set} because {@code Set.contains()} almost certainly returns false for the
|
||||
* {@link Entity} after it is saved. Spring Batch does not store any of its
|
||||
* entities in Sets as a matter of course, so internally this is consistent.
|
||||
* entities in sets as a matter of course, so this is internally consistent.
|
||||
* Clients should not be exposed to unsaved entities.
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.io.StringWriter;
|
||||
* Value object used to carry information about the status of a
|
||||
* job or step execution.
|
||||
*
|
||||
* ExitStatus is immutable and therefore thread-safe.
|
||||
* {@code ExitStatus} is immutable and, therefore, thread-safe.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
@@ -34,8 +34,8 @@ import java.io.StringWriter;
|
||||
public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
|
||||
/**
|
||||
* Convenient constant value representing unknown state - assumed not
|
||||
* continuable.
|
||||
* Convenient constant value representing unknown state - assumed to not
|
||||
* be continuable.
|
||||
*/
|
||||
public static final ExitStatus UNKNOWN = new ExitStatus("UNKNOWN");
|
||||
|
||||
@@ -54,8 +54,8 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
public static final ExitStatus COMPLETED = new ExitStatus("COMPLETED");
|
||||
|
||||
/**
|
||||
* Convenient constant value representing job that did no processing
|
||||
* (e.g. because it was already complete).
|
||||
* Convenient constant value representing a job that did no processing
|
||||
* (for example, because it was already complete).
|
||||
*/
|
||||
public static final ExitStatus NOOP = new ExitStatus("NOOP");
|
||||
|
||||
@@ -115,8 +115,8 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
|
||||
/**
|
||||
* Create a new {@link ExitStatus} with a logical combination of the exit
|
||||
* code, and a concatenation of the descriptions. If either value has a
|
||||
* higher severity then its exit code will be used in the result. In the
|
||||
* code and a concatenation of the descriptions. If either value has a
|
||||
* higher severity, its exit code is used in the result. In the
|
||||
* case of equal severity, the exit code is replaced if the new value is
|
||||
* alphabetically greater.<br>
|
||||
* <br>
|
||||
@@ -132,9 +132,9 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
* </ul>
|
||||
* Others have severity 7, so custom exit codes always win.<br>
|
||||
*
|
||||
* If the input is null just return this.
|
||||
* If the input is {@code null} just return this.
|
||||
*
|
||||
* @param status an {@link ExitStatus} to combine with this one.
|
||||
* @param status An {@link ExitStatus} object to combine with this one.
|
||||
* @return a new {@link ExitStatus} combining the current value and the
|
||||
* argument provided.
|
||||
*/
|
||||
@@ -150,8 +150,9 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param status an {@link ExitStatus} to compare
|
||||
* @return greater than zero, 0, less than zero according to the severity and exit code
|
||||
* @param status An {@link ExitStatus} to compare
|
||||
* @return greater than zero, 0, or less than zero,
|
||||
* according to the severity and exit code.
|
||||
* @see java.lang.Comparable
|
||||
*/
|
||||
@Override
|
||||
@@ -166,8 +167,10 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param status
|
||||
* @return
|
||||
* Determines severity (an int between 1 and 7, inclusive)
|
||||
* based on an {@code ExitStatus} object.
|
||||
* @param status The {@code ExitStatus} object from which to determine the severity.
|
||||
* @return the severity number.
|
||||
*/
|
||||
private int severity(ExitStatus status) {
|
||||
if (status.exitCode.startsWith(EXECUTING.exitCode)) {
|
||||
@@ -202,7 +205,7 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the fields one by one.
|
||||
* Compare the fields, one by one.
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@@ -226,9 +229,9 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
|
||||
/**
|
||||
* Add an exit code to an existing {@link ExitStatus}. If there is already a
|
||||
* code present tit will be replaced.
|
||||
* code present, it will be replaced.
|
||||
*
|
||||
* @param code the code to add
|
||||
* @param code The code to add.
|
||||
* @return a new {@link ExitStatus} with the same properties but a new exit
|
||||
* code.
|
||||
*/
|
||||
@@ -239,7 +242,7 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
/**
|
||||
* Check if this status represents a running process.
|
||||
*
|
||||
* @return true if the exit code is "EXECUTING" or "UNKNOWN"
|
||||
* @return {@code true} if the exit code is {@code EXECUTING} or {@code UNKNOWN}.
|
||||
*/
|
||||
public boolean isRunning() {
|
||||
return "EXECUTING".equals(this.exitCode) || "UNKNOWN".equals(this.exitCode);
|
||||
@@ -247,12 +250,12 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
|
||||
/**
|
||||
* Add an exit description to an existing {@link ExitStatus}. If there is
|
||||
* already a description present the two will be concatenated with a
|
||||
* already a description present, the two are concatenated with a
|
||||
* semicolon.
|
||||
*
|
||||
* @param description the description to add
|
||||
* @param description The description to add.
|
||||
* @return a new {@link ExitStatus} with the same properties but a new exit
|
||||
* description
|
||||
* description.
|
||||
*/
|
||||
public ExitStatus addExitDescription(String description) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
@@ -271,10 +274,10 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
|
||||
/**
|
||||
* Extract the stack trace from the throwable provided and append it to
|
||||
* the exist description.
|
||||
* the existing description.
|
||||
*
|
||||
* @param throwable {@link Throwable} instance containing the stack trace.
|
||||
* @return a new ExitStatus with the stack trace appended
|
||||
* @param throwable A {@link Throwable} instance containing the stack trace.
|
||||
* @return a new ExitStatus with the stack trace appended.
|
||||
*/
|
||||
public ExitStatus addExitDescription(Throwable throwable) {
|
||||
StringWriter writer = new StringWriter();
|
||||
@@ -284,8 +287,8 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param status the exit code to be evaluated
|
||||
* @return true if the value matches a known exit code
|
||||
* @param status The {@code ExitStatus} object containing the exit code to be evaluated.
|
||||
* @return {@code true} if the value matches a known exit code.
|
||||
*/
|
||||
public static boolean isNonDefaultExitStatus(ExitStatus status) {
|
||||
return status == null || status.getExitCode() == null ||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,11 +19,11 @@ import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Listener interface for the processing of an item. Implementations
|
||||
* of this interface will be notified before and after an item is
|
||||
* Listener interface for the processing of an item. Implementations
|
||||
* of this interface are notified before and after an item is
|
||||
* passed to the {@link ItemProcessor} and in the event of any
|
||||
* exceptions thrown by the processor.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
@@ -32,26 +32,26 @@ public interface ItemProcessListener<T, S> extends StepListener {
|
||||
|
||||
/**
|
||||
* Called before {@link ItemProcessor#process(Object)}.
|
||||
*
|
||||
*
|
||||
* @param item to be processed.
|
||||
*/
|
||||
default void beforeProcess(T item) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called after {@link ItemProcessor#process(Object)} returns. If the
|
||||
* processor returns {@code null}, this method will still be called, with
|
||||
* a {code null} result, allowing for notification of 'filtered' items.
|
||||
*
|
||||
* processor returns {@code null}, this method is still called, with
|
||||
* a {@code null} result, allowing for notification of "filtered" items.
|
||||
*
|
||||
* @param item to be processed
|
||||
* @param result of processing
|
||||
*/
|
||||
default void afterProcess(T item, @Nullable S result) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called if an exception was thrown from {@link ItemProcessor#process(Object)}.
|
||||
*
|
||||
*
|
||||
* @param item attempted to be processed
|
||||
* @param e - exception thrown during processing.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,7 @@ import org.springframework.batch.item.ItemReader;
|
||||
|
||||
/**
|
||||
* Listener interface around the reading of an item.
|
||||
*
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
@@ -31,20 +31,20 @@ public interface ItemReadListener<T> extends StepListener {
|
||||
*/
|
||||
default void beforeRead() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called after {@link ItemReader#read()}.
|
||||
* This method is called only for actual items (ie it is not called when the
|
||||
* reader returns null).
|
||||
*
|
||||
* This method is called only for actual items (that is, it is not called when the
|
||||
* reader returns {@code null}).
|
||||
*
|
||||
* @param item returned from read()
|
||||
*/
|
||||
default void afterRead(T item) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called if an error occurs while trying to read.
|
||||
*
|
||||
*
|
||||
* @param ex thrown from {@link ItemReader}
|
||||
*/
|
||||
default void onReadError(Exception ex) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,19 +22,19 @@ import org.springframework.batch.item.ItemWriter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Listener interface for the writing of items. Implementations
|
||||
* of this interface will be notified before, after, and in case
|
||||
* Listener interface for the writing of items. Implementations
|
||||
* of this interface are notified before, after, and in case
|
||||
* of any exception thrown while writing a list of items.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* <em>Note: </em> This listener is designed to work around the
|
||||
* lifecycle of an item. This means that each method should be
|
||||
* called once within the lifecycle of an item and in fault
|
||||
* tolerant scenarios, any transactional work that is done in
|
||||
* one of these methods would be rolled back and not re-applied.
|
||||
* lifecycle of an item. This means that each method should be
|
||||
* called once within the lifecycle of an item and that, in fault-tolerant
|
||||
* scenarios, any transactional work that is done in
|
||||
* one of these methods is rolled back and not re-applied.
|
||||
* Because of this, it is recommended to not perform any logic
|
||||
* using this listener that participates in a transaction.
|
||||
* that participates in a transaction when using this listener.
|
||||
*</p>
|
||||
*
|
||||
* @author Lucas Ward
|
||||
@@ -52,9 +52,9 @@ public interface ItemWriteListener<S> extends StepListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after {@link ItemWriter#write(java.util.List)} This will be
|
||||
* Called after {@link ItemWriter#write(java.util.List)}. This is
|
||||
* called before any transaction is committed, and before
|
||||
* {@link ChunkListener#afterChunk(ChunkContext)}
|
||||
* {@link ChunkListener#afterChunk(ChunkContext)}.
|
||||
*
|
||||
* @param items written items
|
||||
*/
|
||||
@@ -62,7 +62,7 @@ public interface ItemWriteListener<S> extends StepListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called if an error occurs while trying to write. Will be called inside a
|
||||
* Called if an error occurs while trying to write. Called inside a
|
||||
* transaction, but the transaction will normally be rolled back. There is
|
||||
* no way to identify from this callback which of the items (if any) caused
|
||||
* the error.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,11 +18,11 @@ package org.springframework.batch.core;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a job. Job is an explicit abstraction
|
||||
* representing the configuration of a job specified by a developer. It should
|
||||
* be noted that restart policy is applied to the job as a whole and not to a
|
||||
* Batch domain object representing a job. {@code Job} is an explicit abstraction
|
||||
* representing the configuration of a job specified by a developer.
|
||||
* Note that the restart policy is applied to the job as a whole and not to a
|
||||
* step.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@@ -32,26 +32,26 @@ public interface Job {
|
||||
|
||||
/**
|
||||
* Flag to indicate if this job can be restarted, at least in principle.
|
||||
*
|
||||
*
|
||||
* @return true if this job can be restarted after a failure
|
||||
*/
|
||||
boolean isRestartable();
|
||||
|
||||
/**
|
||||
* Run the {@link JobExecution} and update the meta information like status
|
||||
* and statistics as necessary. This method should not throw any exceptions
|
||||
* Run the {@link JobExecution} and update the meta information, such as status
|
||||
* and statistics, as necessary. This method should not throw any exceptions
|
||||
* for failed execution. Clients should be careful to inspect the
|
||||
* {@link JobExecution} status to determine success or failure.
|
||||
*
|
||||
*
|
||||
* @param execution a {@link JobExecution}
|
||||
*/
|
||||
void execute(JobExecution execution);
|
||||
|
||||
/**
|
||||
* If clients need to generate new parameters for the next execution in a
|
||||
* sequence they can use this incrementer. The return value may be {@code null},
|
||||
* in the case that this job does not have a natural sequence.
|
||||
*
|
||||
* sequence, they can use this incrementer. The return value may be {@code null},
|
||||
* when this job does not have a natural sequence.
|
||||
*
|
||||
* @return in incrementer to be used for creating new parameters
|
||||
*/
|
||||
@Nullable
|
||||
@@ -59,11 +59,11 @@ public interface Job {
|
||||
|
||||
/**
|
||||
* A validator for the job parameters of a {@link JobExecution}. Clients of
|
||||
* a Job may need to validate the parameters for a launch, before or during
|
||||
* a {@code Job} may need to validate the parameters for a launch or before or during
|
||||
* the execution.
|
||||
*
|
||||
*
|
||||
* @return a validator that can be used to check parameter values (never
|
||||
* {@code null})
|
||||
* {@code null}).
|
||||
*/
|
||||
JobParametersValidator getJobParametersValidator();
|
||||
|
||||
|
||||
@@ -87,12 +87,12 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Because a JobExecution isn't valid unless the job is set, this
|
||||
* Because a JobExecution is not valid unless the job is set, this
|
||||
* constructor is the only valid one from a modeling point of view.
|
||||
*
|
||||
* @param job the job of which this execution is a part
|
||||
* @param id {@link Long} that represents the id for the JobExecution.
|
||||
* @param jobParameters {@link JobParameters} instance for this JobExecution.
|
||||
* @param job The job of which this execution is a part.
|
||||
* @param id A {@link Long} that represents the {@code id} for the {@code JobExecution}.
|
||||
* @param jobParameters A {@link JobParameters} instance for this {@code JobExecution}.
|
||||
*/
|
||||
public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters) {
|
||||
super(id);
|
||||
@@ -104,16 +104,16 @@ public class JobExecution extends Entity {
|
||||
* Constructor for transient (unsaved) instances.
|
||||
*
|
||||
* @param job The enclosing {@link JobInstance}.
|
||||
* @param jobParameters The {@link JobParameters} instance for this JobExecution.
|
||||
* @param jobParameters The {@link JobParameters} instance for this {@code JobExecution}.
|
||||
*/
|
||||
public JobExecution(JobInstance job, JobParameters jobParameters) {
|
||||
this(job, null, jobParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that accepts the job execution ID and {@link JobParameters}.
|
||||
* Constructor that accepts the job execution {@code id} and {@link JobParameters}.
|
||||
*
|
||||
* @param id The job execution ID.
|
||||
* @param id The job execution {@code id}.
|
||||
* @param jobParameters The {@link JobParameters} for the {@link JobExecution}.
|
||||
*/
|
||||
public JobExecution(Long id, JobParameters jobParameters) {
|
||||
@@ -121,9 +121,9 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that accepts the job execution ID.
|
||||
* Constructor that accepts the job execution {@code id}.
|
||||
*
|
||||
* @param id The job execution ID.
|
||||
* @param id The job execution {@code id}.
|
||||
*/
|
||||
public JobExecution(Long id) {
|
||||
this(null, id, null);
|
||||
@@ -185,30 +185,30 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the status field.
|
||||
* Set the value of the {@code status} field.
|
||||
*
|
||||
* @param status the status to set
|
||||
* @param status The status to set.
|
||||
*/
|
||||
public void setStatus(BatchStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade the status field if the provided value is greater than the
|
||||
* Upgrade the {@code status} field if the provided value is greater than the
|
||||
* existing one. Clients using this method to set the status can be sure
|
||||
* that they don't overwrite a failed status with an successful one.
|
||||
* to not overwrite a failed status with a successful one.
|
||||
*
|
||||
* @param status the new status value
|
||||
* @param status The new status value.
|
||||
*/
|
||||
public void upgradeStatus(BatchStatus status) {
|
||||
this.status = this.status.upgradeTo(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience getter for for the id of the enclosing job. Useful for DAO
|
||||
* Convenience getter for the {@code id} of the enclosing job. Useful for DAO
|
||||
* implementations.
|
||||
*
|
||||
* @return the id of the enclosing job
|
||||
* @return the @{code id} of the enclosing job.
|
||||
*/
|
||||
public Long getJobId() {
|
||||
if (jobInstance != null) {
|
||||
@@ -218,14 +218,14 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exitStatus {@link ExitStatus} instance to be used for job execution.
|
||||
* @param exitStatus The {@link ExitStatus} instance to be used for job execution.
|
||||
*/
|
||||
public void setExitStatus(ExitStatus exitStatus) {
|
||||
this.exitStatus = exitStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the exitCode
|
||||
* @return the {@code exitStatus}.
|
||||
*/
|
||||
public ExitStatus getExitStatus() {
|
||||
return exitStatus;
|
||||
@@ -241,7 +241,7 @@ public class JobExecution extends Entity {
|
||||
/**
|
||||
* Accessor for the step executions.
|
||||
*
|
||||
* @return the step executions that were registered
|
||||
* @return the step executions that were registered.
|
||||
*/
|
||||
public Collection<StepExecution> getStepExecutions() {
|
||||
return Collections.unmodifiableList(new ArrayList<>(stepExecutions));
|
||||
@@ -249,8 +249,8 @@ public class JobExecution extends Entity {
|
||||
|
||||
/**
|
||||
* Register a step execution with the current job execution.
|
||||
* @param stepName the name of the step the new execution is associated with
|
||||
* @return {@link StepExecution} an empty {@code StepExecution} associated with this
|
||||
* @param stepName the name of the step the new execution is associated with.
|
||||
* @return an empty {@link StepExecution} associated with this
|
||||
* {@code JobExecution}.
|
||||
*/
|
||||
public StepExecution createStepExecution(String stepName) {
|
||||
@@ -260,11 +260,10 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if this {@link JobExecution} indicates that it is running. It should
|
||||
* be noted that this does not necessarily mean that it has been persisted
|
||||
* as such yet.
|
||||
* Test if this {@link JobExecution} indicates that it is running.
|
||||
* Note that this does not necessarily mean that it has been persisted.
|
||||
*
|
||||
* @return true if the end time is null and the start time is not null
|
||||
* @return {@code true} if the end time is null and the start time is not null.
|
||||
*/
|
||||
public boolean isRunning() {
|
||||
return startTime != null && endTime == null;
|
||||
@@ -273,16 +272,16 @@ public class JobExecution extends Entity {
|
||||
/**
|
||||
* Test if this {@link JobExecution} indicates that it has been signalled to
|
||||
* stop.
|
||||
* @return true if the status is {@link BatchStatus#STOPPING}
|
||||
* @return {@code true} if the status is {@link BatchStatus#STOPPING}.
|
||||
*/
|
||||
public boolean isStopping() {
|
||||
return status == BatchStatus.STOPPING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ExecutionContext} for this execution
|
||||
* Sets the {@link ExecutionContext} for this execution.
|
||||
*
|
||||
* @param executionContext the context
|
||||
* @param executionContext The context.
|
||||
*/
|
||||
public void setExecutionContext(ExecutionContext executionContext) {
|
||||
this.executionContext = executionContext;
|
||||
@@ -292,7 +291,7 @@ public class JobExecution extends Entity {
|
||||
* Returns the {@link ExecutionContext} for this execution. The content is
|
||||
* expected to be persisted after each step completion (successful or not).
|
||||
*
|
||||
* @return the context
|
||||
* @return The {@link ExecutionContext}.
|
||||
*/
|
||||
public ExecutionContext getExecutionContext() {
|
||||
return executionContext;
|
||||
@@ -306,35 +305,37 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createTime creation time of this execution.
|
||||
* @param createTime The creation time of this execution.
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Package private method for re-constituting the step executions from
|
||||
* Package-private method for re-constituting the step executions from
|
||||
* existing instances.
|
||||
* @param stepExecution execution to be added
|
||||
* @param The {@code stepExecution} execution to be added.
|
||||
*/
|
||||
void addStepExecution(StepExecution stepExecution) {
|
||||
stepExecutions.add(stepExecution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date representing the last time this JobExecution was updated in
|
||||
* the JobRepository.
|
||||
* Get the date representing the last time this {@code JobExecution} was updated in
|
||||
* the {@link JobRepository}.
|
||||
*
|
||||
* @return Date representing the last time this JobExecution was updated.
|
||||
* @return a {@code Date} object representing the last time this
|
||||
* {@code JobExecution} was updated.
|
||||
*/
|
||||
public Date getLastUpdated() {
|
||||
return lastUpdated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the last time this JobExecution was updated.
|
||||
* Set the last time this {@code JobExecution} was updated.
|
||||
*
|
||||
* @param lastUpdated {@link Date} instance to mark job execution's lastUpdated attribute.
|
||||
* @param lastUpdated The {@link Date} instance to which to set
|
||||
* the job execution's {@code lastUpdated} attribute.
|
||||
*/
|
||||
public void setLastUpdated(Date lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
@@ -342,7 +343,7 @@ public class JobExecution extends Entity {
|
||||
|
||||
/**
|
||||
* Retrieve a list of exceptions.
|
||||
* @return The {@link List} of {@link Throwable} objects.
|
||||
* @return the {@link List} of {@link Throwable} objects.
|
||||
*/
|
||||
public List<Throwable> getFailureExceptions() {
|
||||
return failureExceptions;
|
||||
@@ -351,18 +352,18 @@ public class JobExecution extends Entity {
|
||||
/**
|
||||
* Add the provided throwable to the failure exception list.
|
||||
*
|
||||
* @param t {@link Throwable} instance to be added failure exception list.
|
||||
* @param t A {@link Throwable} instance to be added failure exception list.
|
||||
*/
|
||||
public synchronized void addFailureException(Throwable t) {
|
||||
this.failureExceptions.add(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all failure causing exceptions for this JobExecution, including
|
||||
* Return all failure causing exceptions for this {@code JobExecution}, including
|
||||
* step executions.
|
||||
*
|
||||
* @return List<Throwable> containing all exceptions causing failure for
|
||||
* this JobExecution.
|
||||
* @return a {@code List<Throwable>} containing all exceptions causing failure for
|
||||
* this {@code JobExecution}.
|
||||
*/
|
||||
public synchronized List<Throwable> getAllFailureExceptions() {
|
||||
|
||||
@@ -380,8 +381,8 @@ public class JobExecution extends Entity {
|
||||
*
|
||||
* @param stream instance of {@link ObjectInputStream}.
|
||||
*
|
||||
* @throws IOException thrown if error occurs during read.
|
||||
* @throws ClassNotFoundException thrown if class is not found.
|
||||
* @throws {@code IOException} if an error occurs during read.
|
||||
* @throws {@code ClassNotFoundException} thrown if the class is not found.
|
||||
*/
|
||||
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
@@ -401,8 +402,8 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add some step executions. For internal use only.
|
||||
* @param stepExecutions step executions to add to the current list
|
||||
* Add some step executions. For internal use only.
|
||||
* @param stepExecutions The step executions to add to the current list.
|
||||
*/
|
||||
public void addStepExecutions(List<StepExecution> stepExecutions) {
|
||||
if (stepExecutions!=null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,18 +18,18 @@ package org.springframework.batch.core;
|
||||
/**
|
||||
* Root of exception hierarchy for checked exceptions in job and step execution.
|
||||
* Clients of the {@link Job} should expect to have to catch and deal with these
|
||||
* exceptions because they signal a user error, or an inconsistent state between
|
||||
* exceptions because they signal a user error or an inconsistent state between
|
||||
* the user's instructions and the data.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JobExecutionException extends Exception {
|
||||
|
||||
/**
|
||||
* Construct a {@link JobExecutionException} with a generic message.
|
||||
* @param msg the message
|
||||
* @param msg The message.
|
||||
*/
|
||||
public JobExecutionException(String msg) {
|
||||
super(msg);
|
||||
@@ -38,9 +38,9 @@ public class JobExecutionException extends Exception {
|
||||
/**
|
||||
* Construct a {@link JobExecutionException} with a generic message and a
|
||||
* cause.
|
||||
*
|
||||
* @param msg the message
|
||||
* @param cause the cause of the exception
|
||||
*
|
||||
* @param msg The message.
|
||||
* @param cause The cause of the exception.
|
||||
*/
|
||||
public JobExecutionException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,7 @@ package org.springframework.batch.core;
|
||||
/**
|
||||
* Provide callbacks at specific points in the lifecycle of a {@link Job}.
|
||||
* Implementations can be stateful if they are careful to either ensure thread
|
||||
* safety, or to use one instance of a listener per job, assuming that job
|
||||
* safety or to use one instance of a listener per job, assuming that job
|
||||
* instances themselves are not used by more than one thread.
|
||||
*
|
||||
* @author Dave Syer
|
||||
@@ -35,9 +35,9 @@ public interface JobExecutionListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback after completion of a job. Called after both both successful and
|
||||
* Callback after completion of a job. Called after both successful and
|
||||
* failed executions. To perform logic on a particular status, use
|
||||
* "if (jobExecution.getStatus() == BatchStatus.X)".
|
||||
* {@code if (jobExecution.getStatus() == BatchStatus.X)}.
|
||||
*
|
||||
* @param jobExecution the current {@link JobExecution}
|
||||
*/
|
||||
|
||||
@@ -20,12 +20,12 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a uniquely identifiable job run.
|
||||
* JobInstance can be restarted multiple times in case of execution failure and
|
||||
* it's lifecycle ends with first successful execution.
|
||||
* {@code JobInstance} can be restarted multiple times in case of execution failure, and
|
||||
* its lifecycle ends with first successful execution.
|
||||
*
|
||||
* Trying to execute an existing JobInstance that has already completed
|
||||
* successfully will result in error. Error will be raised also for an attempt
|
||||
* to restart a failed JobInstance if the Job is not restartable.
|
||||
* Trying to execute an existing {@code JobInstance} that has already completed
|
||||
* successfully results in an error. An error is also raised for an attempt
|
||||
* to restart a failed {@code JobInstance} if the {@code Job} is not restartable.
|
||||
*
|
||||
* @see Job
|
||||
* @see JobParameters
|
||||
@@ -56,12 +56,15 @@ public class JobInstance extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the job name. (Equivalent to getJob().getName())
|
||||
* @return the job name. (Equivalent to {@code getJob().getName()}).
|
||||
*/
|
||||
public String getJobName() {
|
||||
return jobName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the job name to the string representation of the super class ({@link Entity}).
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ", Job=[" + jobName + "]";
|
||||
|
||||
@@ -20,17 +20,17 @@ package org.springframework.batch.core;
|
||||
/**
|
||||
* Exception to indicate the job has been interrupted. The exception state
|
||||
* indicated is not normally recoverable by batch application clients, but
|
||||
* internally it is useful to force a check. The exception will often be wrapped
|
||||
* in a runtime exception (usually {@link UnexpectedJobExecutionException} before
|
||||
* it is used internally to force a check. The exception is often wrapped
|
||||
* in a runtime exception (usually {@link UnexpectedJobExecutionException}) before
|
||||
* reaching the client.
|
||||
*
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class JobInterruptedException extends JobExecutionException {
|
||||
|
||||
|
||||
private BatchStatus status = BatchStatus.STOPPED;
|
||||
|
||||
/**
|
||||
@@ -52,10 +52,10 @@ public class JobInterruptedException extends JobExecutionException {
|
||||
super(msg);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The desired status of the surrounding execution after the interruption.
|
||||
*
|
||||
*
|
||||
* @return the status of the interruption (default STOPPED)
|
||||
*/
|
||||
public BatchStatus getStatus() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,7 @@ package org.springframework.batch.core;
|
||||
|
||||
/**
|
||||
* Strategy interface for the generation of the key used in identifying
|
||||
* unique {@link JobInstance}.
|
||||
* unique {@link JobInstance} objects.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
@@ -30,10 +30,10 @@ public interface JobKeyGenerator<T> {
|
||||
/**
|
||||
* Method to generate the unique key used to identify a job instance.
|
||||
*
|
||||
* @param source Source information used to generate the key (must not be {@code null})
|
||||
* @param source Source information used to generate the key (must not be {@code null}).
|
||||
*
|
||||
* @return a unique string identifying the job based on the information
|
||||
* supplied
|
||||
* supplied.
|
||||
*/
|
||||
String generateKey(T source);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Domain representation of a parameter to a batch job. Only the following types
|
||||
* can be parameters: String, Long, Date, and Double. The identifying flag is
|
||||
* can be parameters: String, Long, Date, and Double. The identifying flag is
|
||||
* used to indicate if the parameter is to be used as part of the identification of
|
||||
* a job instance.
|
||||
*
|
||||
@@ -44,39 +44,39 @@ public class JobParameter implements Serializable {
|
||||
private final boolean identifying;
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a String.
|
||||
* Construct a new {@code JobParameter} from a {@link String}.
|
||||
* @param parameter {@link String} instance. Must not be {@code null}.
|
||||
* @param identifying true if JobParameter should be identifying.
|
||||
* @param identifying {@code true} if the {@code JobParameter} should be identifying.
|
||||
*/
|
||||
public JobParameter(@NonNull String parameter, boolean identifying) {
|
||||
this(parameter, identifying, ParameterType.STRING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a Long.
|
||||
* Construct a new {@code JobParameter} from a {@link Long}.
|
||||
*
|
||||
* @param parameter {@link Long} instance. Must not be {@code null}.
|
||||
* @param identifying true if JobParameter should be identifying.
|
||||
* @param identifying {@code true} if the {@code JobParameter} should be identifying.
|
||||
*/
|
||||
public JobParameter(@NonNull Long parameter, boolean identifying) {
|
||||
this(parameter, identifying, ParameterType.LONG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a Date.
|
||||
* Construct a new {@code JobParameter} from a {@link Date}.
|
||||
*
|
||||
* @param parameter {@link Date} instance. Must not be {@code null}.
|
||||
* @param identifying true if JobParameter should be identifying.
|
||||
* @param identifying {@code true} if the {@code JobParameter} should be identifying.
|
||||
*/
|
||||
public JobParameter(@NonNull Date parameter, boolean identifying) {
|
||||
this(parameter, identifying, ParameterType.DATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a Double.
|
||||
* Construct a new {@code JobParameter} from a {@link Double}.
|
||||
*
|
||||
* @param parameter {@link Double} instance. Must not be {@code null}.
|
||||
* @param identifying true if JobParameter should be identifying.
|
||||
* @param identifying {@code true} if the {@code JobParameter} should be identifying.
|
||||
*/
|
||||
public JobParameter(@NonNull Double parameter, boolean identifying) {
|
||||
this(parameter, identifying, ParameterType.DOUBLE);
|
||||
@@ -90,57 +90,57 @@ public class JobParameter implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a String.
|
||||
* Construct a new {@code JobParameter} from a {@link String}.
|
||||
*
|
||||
* @param parameter {@link String} instance.
|
||||
* @param parameter A {@link String} instance.
|
||||
*/
|
||||
public JobParameter(String parameter) {
|
||||
this(parameter, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a Long.
|
||||
* Construct a new {@code JobParameter} from a {@link Long}.
|
||||
*
|
||||
* @param parameter {@link Long} instance.
|
||||
* @param parameter A {@link Long} instance.
|
||||
*/
|
||||
public JobParameter(Long parameter) {
|
||||
this(parameter, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a Date.
|
||||
* Construct a new {@code JobParameter} as a {@link Date}.
|
||||
*
|
||||
* @param parameter {@link Date} instance.
|
||||
* @param parameter A {@link Date} instance.
|
||||
*/
|
||||
public JobParameter(Date parameter) {
|
||||
this(parameter, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new JobParameter as a Double.
|
||||
* Construct a new {@code JobParameter} from a {@link Double}.
|
||||
*
|
||||
* @param parameter {@link Double} instance.
|
||||
* @param parameter A {@link Double} instance.
|
||||
*/
|
||||
public JobParameter(Double parameter) {
|
||||
this(parameter, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The identifying flag. It is set to true if the job parameter is identifying.
|
||||
* @return The identifying flag. It is set to {@code true} if the job parameter is identifying.
|
||||
*/
|
||||
public boolean isIdentifying() {
|
||||
return identifying;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value contained within this JobParameter.
|
||||
* @return the value contained within this {@code JobParameter}.
|
||||
*/
|
||||
public Object getValue() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a ParameterType representing the type of this parameter.
|
||||
* @return a {@link ParameterType} representing the type of this parameter.
|
||||
*/
|
||||
public ParameterType getType() {
|
||||
return parameterType;
|
||||
|
||||
@@ -28,15 +28,16 @@ import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Value object representing runtime parameters to a batch job. Because the
|
||||
* parameters have no individual meaning outside of the JobParameters they are
|
||||
* parameters have no individual meaning outside
|
||||
* of the {@code JobParameters} object they are
|
||||
* contained within, it is a value object rather than an entity. It is also
|
||||
* extremely important that a parameters object can be reliably compared to
|
||||
* another for equality, in order to determine if one JobParameters object
|
||||
* equals another. Furthermore, because these parameters will need to be
|
||||
* another for equality, in order to determine if one {@code JobParameters} object
|
||||
* equals another. Furthermore, because these parameters need to be
|
||||
* persisted, it is vital that the types added are restricted.
|
||||
*
|
||||
* This class is immutable and therefore thread-safe.
|
||||
*
|
||||
*
|
||||
* This class is immutable and, therefore, thread-safe.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
@@ -56,19 +57,21 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that is initialized with the content of a {@link Map} that contains a string key and {@link JobParameter} value.
|
||||
* Constructor that is initialized with the content of a {@link Map}
|
||||
* that contains a {@code String} key and a {@link JobParameter} value.
|
||||
*
|
||||
* @param parameters The {@link Map} that contains a string key and {@link JobParameter} value.
|
||||
* @param parameters The {@link Map} that contains a {@code String} key
|
||||
* and a {@link JobParameter} value.
|
||||
*/
|
||||
public JobParameters(Map<String,JobParameter> parameters) {
|
||||
this.parameters = new LinkedHashMap<>(parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the Long represented by the provided key.
|
||||
*
|
||||
* @param key The key to get a value for
|
||||
* @return The <code>Long</code> value or {@code null} if the key is absent
|
||||
* Typesafe getter for the {@link Long} represented by the provided key.
|
||||
*
|
||||
* @param key The key for which to get a value.
|
||||
* @return The {@link Long} value or {@code null} if the key is absent.
|
||||
*/
|
||||
@Nullable
|
||||
public Long getLong(String key){
|
||||
@@ -80,13 +83,13 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the Long represented by the provided key. If the
|
||||
* key does not exist, the default value will be returned.
|
||||
* Typesafe getter for the {@link Long} represented by the provided key. If the
|
||||
* key does not exist, the default value is returned.
|
||||
*
|
||||
* @param key to return the value for
|
||||
* @param defaultValue to return if the value doesn't exist
|
||||
* @return the parameter represented by the provided key, defaultValue
|
||||
* otherwise.
|
||||
* @param key The key for which to return the value.
|
||||
* @param defaultValue The default value to return if the value does not exist.
|
||||
* @return the parameter represented by the provided key or, if that is
|
||||
* missing, the default value.
|
||||
*/
|
||||
@Nullable
|
||||
public Long getLong(String key, @Nullable Long defaultValue){
|
||||
@@ -99,10 +102,10 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the String represented by the provided key.
|
||||
*
|
||||
* @param key The key to get a value for
|
||||
* @return The <code>String</code> value or {@code null} if the key is absent
|
||||
* Typesafe getter for the {@link String} represented by the provided key.
|
||||
*
|
||||
* @param key The key for which to get a value.
|
||||
* @return The {@link String} value or {@code null} if the key is absent.
|
||||
*/
|
||||
@Nullable
|
||||
public String getString(String key){
|
||||
@@ -111,13 +114,13 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the String represented by the provided key. If the
|
||||
* key does not exist, the default value will be returned.
|
||||
*
|
||||
* @param key to return the value for
|
||||
* @param defaultValue to return if the value doesn't exist
|
||||
* @return the parameter represented by the provided key, defaultValue
|
||||
* otherwise.
|
||||
* Typesafe getter for the {@link String} represented by the provided key. If the
|
||||
* key does not exist, the default value is returned.
|
||||
*
|
||||
* @param key The key for which to return the value.
|
||||
* @param defaultValue The defult value to return if the value does not exist.
|
||||
* @return the parameter represented by the provided key or, if that is
|
||||
* missing, the default value.
|
||||
*/
|
||||
@Nullable
|
||||
public String getString(String key, @Nullable String defaultValue){
|
||||
@@ -130,10 +133,10 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the Long represented by the provided key.
|
||||
*
|
||||
* @param key The key to get a value for
|
||||
* @return The <code>Double</code> value or {@code null} if the key is absent
|
||||
* Typesafe getter for the {@link Long} represented by the provided key.
|
||||
*
|
||||
* @param key The key for which to get a value.
|
||||
* @return The {@link Double} value or {@code null} if the key is absent.
|
||||
*/
|
||||
@Nullable
|
||||
public Double getDouble(String key){
|
||||
@@ -145,13 +148,13 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the Double represented by the provided key. If the
|
||||
* key does not exist, the default value will be returned.
|
||||
* Typesafe getter for the {@link Double} represented by the provided key. If the
|
||||
* key does not exist, the default value is returned.
|
||||
*
|
||||
* @param key to return the value for
|
||||
* @param defaultValue to return if the value doesn't exist
|
||||
* @return the parameter represented by the provided key, defaultValue
|
||||
* otherwise.
|
||||
* @param key The key for which to return the value.
|
||||
* @param defaultValue The default value to return if the value does not exist.
|
||||
* @return the parameter represented by the provided key or, if that is
|
||||
* missing, the default value.
|
||||
*/
|
||||
@Nullable
|
||||
public Double getDouble(String key, @Nullable Double defaultValue){
|
||||
@@ -164,11 +167,11 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the Date represented by the provided key.
|
||||
*
|
||||
* @param key The key to get a value for
|
||||
* @return The <code>java.util.Date</code> value or {@code null} if the key
|
||||
* is absent
|
||||
* Typesafe getter for the {@link Date} represented by the provided key.
|
||||
*
|
||||
* @param key The key for which to get a value.
|
||||
* @return the {@link java.util.Date} value or {@code null} if the key
|
||||
* is absent.
|
||||
*/
|
||||
@Nullable
|
||||
public Date getDate(String key){
|
||||
@@ -176,13 +179,13 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Typesafe Getter for the Date represented by the provided key. If the
|
||||
* key does not exist, the default value will be returned.
|
||||
*
|
||||
* @param key to return the value for
|
||||
* @param defaultValue to return if the value doesn't exist
|
||||
* @return the parameter represented by the provided key, defaultValue
|
||||
* otherwise.
|
||||
* Typesafe getter for the {@link Date} represented by the provided key. If the
|
||||
* key does not exist, the default value is returned.
|
||||
*
|
||||
* @param key The key for which to return the value.
|
||||
* @param defaultValue The default value to return if the value does not exist.
|
||||
* @return the parameter represented by the provided key or, if that is
|
||||
* missing, the default value.
|
||||
*/
|
||||
@Nullable
|
||||
public Date getDate(String key, @Nullable Date defaultValue){
|
||||
@@ -195,8 +198,9 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a map of all parameters, including string, long, and date.
|
||||
*
|
||||
* Get a map of all parameters, including {@link String},
|
||||
* {@link Long}, and {@link Date} types.
|
||||
*
|
||||
* @return an unmodifiable map containing all parameters.
|
||||
*/
|
||||
public Map<String, JobParameter> getParameters(){
|
||||
@@ -204,7 +208,7 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the parameters is empty, false otherwise.
|
||||
* @return {@code true} if the parameters object is empty or {@code false} otherwise.
|
||||
*/
|
||||
public boolean isEmpty(){
|
||||
return parameters.isEmpty();
|
||||
@@ -235,7 +239,7 @@ public class JobParameters implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The {@link Properties} that contain the key and values for the {@link JobParameter}s.
|
||||
* @return The {@link Properties} that contain the key and values for the {@link JobParameter} objects.
|
||||
*/
|
||||
public Properties toProperties() {
|
||||
Properties props = new Properties();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,14 +28,14 @@ import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Helper class for creating {@link JobParameters}. Useful because all
|
||||
* {@link JobParameter} objects are immutable, and must be instantiated separately
|
||||
* {@link JobParameter} objects are immutable and must be instantiated separately
|
||||
* to ensure type safety. Once created, it can be used in the
|
||||
* same was a java.lang.StringBuilder (except, order is irrelevant), by adding
|
||||
* various parameter types and creating a valid {@link JobParameters} once
|
||||
* same was a {@link java.lang.StringBuilder} (except that order is irrelevant), by adding
|
||||
* various parameter types and creating a valid {@link JobParameters} object once
|
||||
* finished.<br>
|
||||
* <br>
|
||||
* Using the identifying flag indicates if the parameter will be used
|
||||
* in the identification of a JobInstance. That flag defaults to true.
|
||||
* Using the {@code identifying} flag indicates if the parameter should be used
|
||||
* in the identification of a {@link JobInstance} object. That flag defaults to {@code true}.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Michael Minella
|
||||
@@ -59,7 +59,7 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jobExplorer {@link JobExplorer} used for looking up previous job parameter information
|
||||
* @param jobExplorer {@link JobExplorer} used for looking up previous job parameter information.
|
||||
*/
|
||||
public JobParametersBuilder(JobExplorer jobExplorer) {
|
||||
this.jobExplorer = jobExplorer;
|
||||
@@ -75,10 +75,10 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to add conversion capabilities to support JSR-352. Per the spec, it is expected that all
|
||||
* keys and values in the provided {@link Properties} instance are Strings
|
||||
* Constructor to add conversion capabilities to support JSR-352. Per the spec, it is expected that all
|
||||
* keys and values in the provided {@link Properties} instance are {@link String} objects.
|
||||
*
|
||||
* @param properties the job parameters to be used
|
||||
* @param properties the job parameters to be used.
|
||||
*/
|
||||
public JobParametersBuilder(Properties properties) {
|
||||
this.parameterMap = new LinkedHashMap<>();
|
||||
@@ -93,7 +93,7 @@ public class JobParametersBuilder {
|
||||
/**
|
||||
* Copy constructor. Initializes the builder with the supplied parameters.
|
||||
* @param jobParameters {@link JobParameters} instance used to initialize the builder.
|
||||
* @param jobExplorer {@link JobExplorer} used for looking up previous job parameter information
|
||||
* @param jobExplorer {@link JobExplorer} used for looking up previous job parameter information.
|
||||
*/
|
||||
public JobParametersBuilder(JobParameters jobParameters, JobExplorer jobExplorer) {
|
||||
this.jobExplorer = jobExplorer;
|
||||
@@ -103,8 +103,8 @@ public class JobParametersBuilder {
|
||||
/**
|
||||
* Add a new identifying String parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addString(String key, @NonNull String parameter) {
|
||||
@@ -115,9 +115,9 @@ public class JobParametersBuilder {
|
||||
/**
|
||||
* Add a new String parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param identifying - indicates if the parameter is used as part of identifying a job instance
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @param identifying The indicates if the parameter is used as part of identifying a job instance.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addString(String key, @NonNull String parameter, boolean identifying) {
|
||||
@@ -128,8 +128,8 @@ public class JobParametersBuilder {
|
||||
/**
|
||||
* Add a new identifying {@link Date} parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addDate(String key, @NonNull Date parameter) {
|
||||
@@ -140,9 +140,9 @@ public class JobParametersBuilder {
|
||||
/**
|
||||
* Add a new {@link Date} parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param identifying - indicates if the parameter is used as part of identifying a job instance
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @param identifying Indicates if the parameter is used as part of identifying a job instance
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addDate(String key, @NonNull Date parameter, boolean identifying) {
|
||||
@@ -151,10 +151,10 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new identifying Long parameter for the given key.
|
||||
* Add a new identifying {@link Long} parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addLong(String key, @NonNull Long parameter) {
|
||||
@@ -163,11 +163,11 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Long parameter for the given key.
|
||||
* Add a new {@link Long} parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param identifying - indicates if the parameter is used as part of identifying a job instance
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @param identifying Indicates if the parameter is used as part of identifying a job instance.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addLong(String key, @NonNull Long parameter, boolean identifying) {
|
||||
@@ -176,10 +176,10 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new identifying Double parameter for the given key.
|
||||
* Add a new identifying {@link Double} parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addDouble(String key, @NonNull Double parameter) {
|
||||
@@ -188,11 +188,11 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Double parameter for the given key.
|
||||
* Add a new {@link Double} parameter for the given key.
|
||||
*
|
||||
* @param key - parameter accessor.
|
||||
* @param parameter - runtime parameter. Must not be {@code null}.
|
||||
* @param identifying - indicates if the parameter is used as part of identifying a job instance
|
||||
* @param key The parameter accessor.
|
||||
* @param parameter The runtime parameter. Must not be {@code null}.
|
||||
* @param identifying Indicates if the parameter is used as part of identifying a job instance.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addDouble(String key, @NonNull Double parameter, boolean identifying) {
|
||||
@@ -202,7 +202,7 @@ public class JobParametersBuilder {
|
||||
|
||||
/**
|
||||
* Conversion method that takes the current state of this builder and
|
||||
* returns it as a JobParameters object.
|
||||
* returns it as a {@code JobParameters} object.
|
||||
*
|
||||
* @return a valid {@link JobParameters} object.
|
||||
*/
|
||||
@@ -213,8 +213,8 @@ public class JobParametersBuilder {
|
||||
/**
|
||||
* Add a new {@link JobParameter} for the given key.
|
||||
*
|
||||
* @param key - parameter accessor
|
||||
* @param jobParameter - runtime parameter
|
||||
* @param key The parameter accessor.
|
||||
* @param jobParameter The runtime parameter.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addParameter(String key, JobParameter jobParameter) {
|
||||
@@ -225,7 +225,7 @@ public class JobParametersBuilder {
|
||||
|
||||
/**
|
||||
* Copy job parameters into the current state.
|
||||
* @param jobParameters parameters to copy in
|
||||
* @param jobParameters The parameters to copy in.
|
||||
* @return a reference to this object.
|
||||
*/
|
||||
public JobParametersBuilder addJobParameters(JobParameters jobParameters) {
|
||||
@@ -237,14 +237,14 @@ public class JobParametersBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the {@link JobParameters} based on the state of the {@link Job}. This
|
||||
* Initializes the {@link JobParameters} based on the state of the {@link Job}. This
|
||||
* should be called after all parameters have been entered into the builder.
|
||||
* All parameters already set on this builder instance will be appended to
|
||||
* those retrieved from the job incrementer, overriding any with the same key (Same
|
||||
* behaviour as {@link org.springframework.batch.core.launch.support.CommandLineJobRunner}
|
||||
* with "-next" option and {@link org.springframework.batch.core.launch.JobOperator#startNextInstance(String)})
|
||||
* All parameters already set on this builder instance are appended to
|
||||
* those retrieved from the job incrementer, overriding any with the same key (this is the same
|
||||
* behavior as {@link org.springframework.batch.core.launch.support.CommandLineJobRunner}
|
||||
* with the {@code -next} option and {@link org.springframework.batch.core.launch.JobOperator#startNextInstance(String)}).
|
||||
*
|
||||
* @param job the job for which the {@link JobParameters} are being constructed.
|
||||
* @param job The job for which the {@link JobParameters} are being constructed.
|
||||
* @return a reference to this object.
|
||||
*
|
||||
* @since 4.0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,8 +18,8 @@ package org.springframework.batch.core;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for obtaining the next {@link JobParameters} in a sequence.
|
||||
*
|
||||
* Interface for obtaining the next {@link JobParameters} object in a sequence.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
@@ -28,10 +28,10 @@ import org.springframework.lang.Nullable;
|
||||
public interface JobParametersIncrementer {
|
||||
|
||||
/**
|
||||
* Increment the provided parameters. If the input is empty, then this
|
||||
* Increments the provided parameters. If the input is empty, this method
|
||||
* should return a bootstrap or initial value to be used on the first
|
||||
* instance of a job.
|
||||
*
|
||||
*
|
||||
* @param parameters the last value used
|
||||
* @return the next value to use (never {@code null})
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 the original author or authors.
|
||||
* Copyright 2010-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,7 @@ import org.springframework.lang.Nullable;
|
||||
/**
|
||||
* Strategy interface for a {@link Job} to use in validating its parameters for
|
||||
* an execution.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
@@ -28,9 +28,9 @@ import org.springframework.lang.Nullable;
|
||||
public interface JobParametersValidator {
|
||||
|
||||
/**
|
||||
* Check the parameters meet whatever requirements are appropriate, and
|
||||
* Check that the parameters meet whatever requirements are appropriate, and
|
||||
* throw an exception if not.
|
||||
*
|
||||
*
|
||||
* @param parameters some {@link JobParameters} (can be {@code null})
|
||||
* @throws JobParametersInvalidException if the parameters are invalid
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,26 +16,26 @@
|
||||
package org.springframework.batch.core;
|
||||
|
||||
/**
|
||||
* Interface for listener to skipped items. Callbacks will be called by
|
||||
* Interface for listener to skipped items. Callbacks are called by
|
||||
* {@link Step} implementations at the appropriate time in the step lifecycle.
|
||||
* Implementers of this interface should not assume that any method will be
|
||||
* called immediately after an error has been encountered. Because there
|
||||
* may be errors later on in processing the chunk, this listener will not be
|
||||
* Implementers of this interface should not assume that any method is
|
||||
* called immediately after an error has been encountered. Because there
|
||||
* may be errors later on in processing the chunk, this listener is not
|
||||
* called until just before committing.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface SkipListener<T,S> extends StepListener {
|
||||
|
||||
/**
|
||||
* Callback for a failure on read that is legal, so is not going to be
|
||||
* re-thrown. In case transaction is rolled back and items are re-read, this
|
||||
* callback will occur repeatedly for the same cause. This will only happen
|
||||
* Callback for a failure on read that is legal and, consequently, is not going to be
|
||||
* re-thrown. In case a transaction is rolled back and items are re-read, this
|
||||
* callback occurs repeatedly for the same cause. This happens only
|
||||
* if read items are not buffered.
|
||||
*
|
||||
*
|
||||
* @param t cause of the failure
|
||||
*/
|
||||
default void onSkipInRead(Throwable t) {
|
||||
@@ -43,8 +43,8 @@ public interface SkipListener<T,S> extends StepListener {
|
||||
|
||||
/**
|
||||
* This item failed on write with the given exception, and a skip was called
|
||||
* for.
|
||||
*
|
||||
* for.
|
||||
*
|
||||
* @param item the failed item
|
||||
* @param t the cause of the failure
|
||||
*/
|
||||
@@ -53,8 +53,8 @@ public interface SkipListener<T,S> extends StepListener {
|
||||
|
||||
/**
|
||||
* This item failed on processing with the given exception, and a skip was called
|
||||
* for.
|
||||
*
|
||||
* for.
|
||||
*
|
||||
* @param item the failed item
|
||||
* @param t the cause of the failure
|
||||
*/
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
package org.springframework.batch.core;
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the {@link Job}, a {@link Step} is meant to
|
||||
* explicitly represent the configuration of a step by a developer, but also the ability to execute the step.
|
||||
*
|
||||
* Batch domain interface representing the configuration of a step. As with a {@link Job}, a {@link Step} is meant to
|
||||
* explicitly represent the configuration of a step by a developer but also the ability to execute the step.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface Step {
|
||||
|
||||
/**
|
||||
* The key to retrieve the batch step type.
|
||||
* The key to use when retrieving the batch step type.
|
||||
*/
|
||||
String STEP_TYPE_KEY = "batch.stepType";
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface Step {
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return true if a step that is already marked as complete can be started again.
|
||||
* @return {@code true} if a step that is already marked as complete can be started again.
|
||||
*/
|
||||
boolean isAllowStartIfComplete();
|
||||
|
||||
@@ -46,14 +46,14 @@ public interface Step {
|
||||
|
||||
/**
|
||||
* Process the step and assign progress and status meta information to the {@link StepExecution} provided. The
|
||||
* {@link Step} is responsible for setting the meta information and also saving it if required by the
|
||||
* {@link Step} is responsible for setting the meta information and also saving it, if required by the
|
||||
* implementation.<br>
|
||||
*
|
||||
* It is not safe to re-use an instance of {@link Step} to process multiple concurrent executions.
|
||||
*
|
||||
* @param stepExecution an entity representing the step to be executed
|
||||
*
|
||||
* @throws JobInterruptedException if the step is interrupted externally
|
||||
*
|
||||
* It is not safe to reuse an instance of {@link Step} to process multiple concurrent executions.
|
||||
*
|
||||
* @param stepExecution an entity representing the step to be executed.
|
||||
*
|
||||
* @throws JobInterruptedException if the step is interrupted externally.
|
||||
*/
|
||||
void execute(StepExecution stepExecution) throws JobInterruptedException;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,7 +65,7 @@ public class StepContribution implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Public getter for the status.
|
||||
* Public getter for the {@code ExitStatus}.
|
||||
*
|
||||
* @return the {@link ExitStatus} for this contribution
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ public class StepContribution implements Serializable {
|
||||
/**
|
||||
* Increment the counter for the number of items processed.
|
||||
*
|
||||
* @param count long amount to increment by.
|
||||
* @param count The {@code long} amount to increment by.
|
||||
*/
|
||||
public void incrementFilterCount(long count) {
|
||||
filterCount += count;
|
||||
@@ -92,7 +92,7 @@ public class StepContribution implements Serializable {
|
||||
/**
|
||||
* Increment the counter for the number of items written.
|
||||
*
|
||||
* @param count long amount to increment by.
|
||||
* @param count The {@code long} amount to increment by.
|
||||
*/
|
||||
public void incrementWriteCount(long count) {
|
||||
writeCount += count;
|
||||
@@ -101,7 +101,7 @@ public class StepContribution implements Serializable {
|
||||
/**
|
||||
* Public access to the read counter.
|
||||
*
|
||||
* @return the item counter.
|
||||
* @return the read item counter.
|
||||
*/
|
||||
public long getReadCount() {
|
||||
return readCount;
|
||||
@@ -110,7 +110,7 @@ public class StepContribution implements Serializable {
|
||||
/**
|
||||
* Public access to the write counter.
|
||||
*
|
||||
* @return the item counter.
|
||||
* @return the write item counter.
|
||||
*/
|
||||
public long getWriteCount() {
|
||||
return writeCount;
|
||||
@@ -119,7 +119,7 @@ public class StepContribution implements Serializable {
|
||||
/**
|
||||
* Public getter for the filter counter.
|
||||
*
|
||||
* @return the filter counter
|
||||
* @return the filter counter.
|
||||
*/
|
||||
public long getFilterCount() {
|
||||
return filterCount;
|
||||
@@ -143,23 +143,23 @@ public class StepContribution implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the read skip count for this contribution
|
||||
* Increment the read skip count for this contribution.
|
||||
*/
|
||||
public void incrementReadSkipCount() {
|
||||
readSkipCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the read skip count for this contribution
|
||||
* Increment the read skip count for this contribution.
|
||||
*
|
||||
* @param count long amount to increment by.
|
||||
* @param count The {@code long} amount to increment by.
|
||||
*/
|
||||
public void incrementReadSkipCount(long count) {
|
||||
readSkipCount += count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the write skip count for this contribution
|
||||
* Increment the write skip count for this contribution.
|
||||
*/
|
||||
public void incrementWriteSkipCount() {
|
||||
writeSkipCount++;
|
||||
@@ -173,14 +173,18 @@ public class StepContribution implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the read skip count
|
||||
* Public getter for the read skip count.
|
||||
*
|
||||
* @return the read skip count.
|
||||
*/
|
||||
public long getReadSkipCount() {
|
||||
return readSkipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the write skip count
|
||||
* Public getter for the write skip count.
|
||||
*
|
||||
* @return the write skip count.
|
||||
*/
|
||||
public long getWriteSkipCount() {
|
||||
return writeSkipCount;
|
||||
@@ -189,7 +193,7 @@ public class StepContribution implements Serializable {
|
||||
/**
|
||||
* Public getter for the process skip count.
|
||||
*
|
||||
* @return the process skip count
|
||||
* @return the process skip count.
|
||||
*/
|
||||
public long getProcessSkipCount() {
|
||||
return processSkipCount;
|
||||
@@ -197,6 +201,7 @@ public class StepContribution implements Serializable {
|
||||
|
||||
/**
|
||||
* Public getter for the parent step execution of this contribution.
|
||||
*
|
||||
* @return parent step execution of this contribution
|
||||
*/
|
||||
public StepExecution getStepExecution() {
|
||||
|
||||
@@ -28,9 +28,9 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Batch domain object representation the execution of a step. Unlike
|
||||
* {@link JobExecution}, there are additional properties related the processing
|
||||
* of items such as commit count, etc.
|
||||
* Batch domain object representation for the execution of a step. Unlike
|
||||
* {@link JobExecution}, additional properties are related to the processing
|
||||
* of items, such as commit count and others.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
@@ -82,9 +82,9 @@ public class StepExecution extends Entity {
|
||||
/**
|
||||
* Constructor with mandatory properties.
|
||||
*
|
||||
* @param stepName the step to which this execution belongs
|
||||
* @param jobExecution the current job execution
|
||||
* @param id the id of this execution
|
||||
* @param stepName The step to which this execution belongs.
|
||||
* @param jobExecution The current job execution.
|
||||
* @param id The ID of this execution.
|
||||
*/
|
||||
public StepExecution(String stepName, JobExecution jobExecution, Long id) {
|
||||
this(stepName, jobExecution);
|
||||
@@ -95,10 +95,10 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that substitutes in null for the execution id
|
||||
* Constructor that substitutes null for the execution ID.
|
||||
*
|
||||
* @param stepName the step to which this execution belongs
|
||||
* @param jobExecution the current job execution
|
||||
* @param stepName The step to which this execution belongs.
|
||||
* @param jobExecution The current job execution.
|
||||
*/
|
||||
public StepExecution(String stepName, JobExecution jobExecution) {
|
||||
super();
|
||||
@@ -108,11 +108,11 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that requires only a stepName. Intended only to be
|
||||
* used via serialization libraries to address the circular
|
||||
* Constructor that requires only a stepName. Intended only to be
|
||||
* used over serialization libraries to address the circular
|
||||
* reference between {@link JobExecution} and StepExecution.
|
||||
*
|
||||
* @param stepName the name of the executed step
|
||||
* @param stepName The name of the executed step.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private StepExecution(String stepName) {
|
||||
@@ -123,45 +123,45 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link ExecutionContext} for this execution
|
||||
* Returns the {@link ExecutionContext} for this execution.
|
||||
*
|
||||
* @return the attributes
|
||||
* @return the attributes.
|
||||
*/
|
||||
public ExecutionContext getExecutionContext() {
|
||||
return executionContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link ExecutionContext} for this execution
|
||||
* Sets the {@link ExecutionContext} for this execution.
|
||||
*
|
||||
* @param executionContext the attributes
|
||||
* @param executionContext The attributes.
|
||||
*/
|
||||
public void setExecutionContext(ExecutionContext executionContext) {
|
||||
this.executionContext = executionContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current number of commits for this execution
|
||||
* Returns the current number of commits for this execution.
|
||||
*
|
||||
* @return the current number of commits
|
||||
* @return the current number of commits.
|
||||
*/
|
||||
public long getCommitCount() {
|
||||
return commitCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current number of commits for this execution
|
||||
* Sets the current number of commits for this execution.
|
||||
*
|
||||
* @param commitCount the current number of commits
|
||||
* @param commitCount The current number of commits.
|
||||
*/
|
||||
public void setCommitCount(long commitCount) {
|
||||
this.commitCount = commitCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time that this execution ended or {@code null} if the step is running.
|
||||
* Returns the time when this execution ended or {@code null} if the step is running.
|
||||
*
|
||||
* @return the time that this execution ended or {@code null} if the step is running
|
||||
* @return the time when this execution ended or {@code null} if the step is running.
|
||||
*/
|
||||
@Nullable
|
||||
public Date getEndTime() {
|
||||
@@ -169,82 +169,82 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time that this execution ended
|
||||
* Sets the time when this execution ended.
|
||||
*
|
||||
* @param endTime the time that this execution ended
|
||||
* @param endTime The time when this execution ended.
|
||||
*/
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current number of items read for this execution
|
||||
* Returns the current number of items read for this execution.
|
||||
*
|
||||
* @return the current number of items read for this execution
|
||||
* @return the current number of items read for this execution.
|
||||
*/
|
||||
public long getReadCount() {
|
||||
return readCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current number of read items for this execution
|
||||
* Sets the current number of read items for this execution.
|
||||
*
|
||||
* @param readCount the current number of read items for this execution
|
||||
* @param readCount The current number of read items for this execution.
|
||||
*/
|
||||
public void setReadCount(long readCount) {
|
||||
this.readCount = readCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current number of items written for this execution
|
||||
* Returns the current number of items written for this execution.
|
||||
*
|
||||
* @return the current number of items written for this execution
|
||||
* @return The current number of items written for this execution.
|
||||
*/
|
||||
public long getWriteCount() {
|
||||
return writeCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current number of written items for this execution
|
||||
* Sets the current number of written items for this execution.
|
||||
*
|
||||
* @param writeCount the current number of written items for this execution
|
||||
* @param writeCount The current number of written items for this execution.
|
||||
*/
|
||||
public void setWriteCount(long writeCount) {
|
||||
this.writeCount = writeCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current number of rollbacks for this execution
|
||||
* Returns the current number of rollbacks for this execution.
|
||||
*
|
||||
* @return the current number of rollbacks for this execution
|
||||
* @return the current number of rollbacks for this execution.
|
||||
*/
|
||||
public long getRollbackCount() {
|
||||
return rollbackCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current number of items filtered out of this execution
|
||||
* Returns the current number of items filtered out of this execution.
|
||||
*
|
||||
* @return the current number of items filtered out of this execution
|
||||
* @return the current number of items filtered out of this execution.
|
||||
*/
|
||||
public long getFilterCount() {
|
||||
return filterCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public setter for the number of items filtered out of this execution.
|
||||
* Sets the number of items filtered out of this execution.
|
||||
*
|
||||
* @param filterCount the number of items filtered out of this execution to
|
||||
* set
|
||||
* @param filterCount The number of items filtered out of this execution to
|
||||
* set.
|
||||
*/
|
||||
public void setFilterCount(long filterCount) {
|
||||
this.filterCount = filterCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for number of rollbacks for this execution
|
||||
* Sets the number of rollbacks for this execution.
|
||||
*
|
||||
* @param rollbackCount long the number of rollbacks.
|
||||
* @param rollbackCount {@code long} the number of rollbacks.
|
||||
*/
|
||||
public void setRollbackCount(long rollbackCount) {
|
||||
this.rollbackCount = rollbackCount;
|
||||
@@ -269,36 +269,36 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time this execution started
|
||||
* Gets the time when this execution started.
|
||||
*
|
||||
* @return the time this execution started
|
||||
* @return the time when this execution started.
|
||||
*/
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the time this execution started
|
||||
* Sets the time when this execution started.
|
||||
*
|
||||
* @param startTime the time this execution started
|
||||
* @param startTime The time when this execution started.
|
||||
*/
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current status of this step
|
||||
* Returns the current status of this step.
|
||||
*
|
||||
* @return the current status of this step
|
||||
* @return the current status of this step.
|
||||
*/
|
||||
public BatchStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current status of this step
|
||||
* Sets the current status of this step.
|
||||
*
|
||||
* @param status the current status of this step
|
||||
* @param status The current status of this step.
|
||||
*/
|
||||
public void setStatus(BatchStatus status) {
|
||||
this.status = status;
|
||||
@@ -307,25 +307,25 @@ public class StepExecution extends Entity {
|
||||
/**
|
||||
* Upgrade the status field if the provided value is greater than the
|
||||
* existing one. Clients using this method to set the status can be sure
|
||||
* that they don't overwrite a failed status with an successful one.
|
||||
* that they do not overwrite a failed status with a successful one.
|
||||
*
|
||||
* @param status the new status value
|
||||
* @param status The new status value,
|
||||
*/
|
||||
public void upgradeStatus(BatchStatus status) {
|
||||
this.status = this.status.upgradeTo(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the step
|
||||
* @return the name of the step.
|
||||
*/
|
||||
public String getStepName() {
|
||||
return stepName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for the job execution id.
|
||||
* Accessor for the job execution ID.
|
||||
*
|
||||
* @return the jobExecutionId
|
||||
* @return the {@code jobExecutionId}.
|
||||
*/
|
||||
public Long getJobExecutionId() {
|
||||
if (jobExecution != null) {
|
||||
@@ -335,14 +335,14 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exitStatus {@link ExitStatus} instance used to establish the exit status.
|
||||
* @param exitStatus The {@link ExitStatus} instance used to establish the exit status.
|
||||
*/
|
||||
public void setExitStatus(ExitStatus exitStatus) {
|
||||
this.exitStatus = exitStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the exitCode
|
||||
* @return the {@code ExitStatus}.
|
||||
*/
|
||||
public ExitStatus getExitStatus() {
|
||||
return exitStatus;
|
||||
@@ -368,11 +368,11 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* On successful execution just before a chunk commit, this method should be
|
||||
* called. Synchronizes access to the {@link StepExecution} so that changes
|
||||
* This method should be called on successful execution just before a chunk commit.
|
||||
* Synchronizes access to the {@link StepExecution} so that changes
|
||||
* are atomic.
|
||||
*
|
||||
* @param contribution {@link StepContribution} instance used to update the StepExecution state.
|
||||
* @param contribution The {@link StepContribution} instance used to update the {@code StepExecution} state.
|
||||
*/
|
||||
public synchronized void apply(StepContribution contribution) {
|
||||
readSkipCount += contribution.getReadSkipCount();
|
||||
@@ -385,21 +385,22 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* On unsuccessful execution after a chunk has rolled back.
|
||||
* Increments the rollback count.
|
||||
* Should be used on unsuccessful execution after a chunk has rolled back.
|
||||
*/
|
||||
public synchronized void incrementRollbackCount() {
|
||||
rollbackCount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return flag to indicate that an execution should halt
|
||||
* @return flag to indicate that an execution should halt.
|
||||
*/
|
||||
public boolean isTerminateOnly() {
|
||||
return this.terminateOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a flag that will signal to an execution environment that this
|
||||
* Sets a flag that signals to an execution environment that this
|
||||
* execution (and its surrounding job) wishes to exit.
|
||||
*/
|
||||
public void setTerminateOnly() {
|
||||
@@ -414,7 +415,7 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the number of commits
|
||||
* Increment the number of commits.
|
||||
*/
|
||||
public void incrementCommitCount() {
|
||||
commitCount++;
|
||||
@@ -423,8 +424,8 @@ public class StepExecution extends Entity {
|
||||
/**
|
||||
* Convenience method to get the current job parameters.
|
||||
*
|
||||
* @return the {@link JobParameters} from the enclosing job, or empty if
|
||||
* that is null
|
||||
* @return the {@link JobParameters} from the enclosing job or empty if
|
||||
* that is {@code null}.
|
||||
*/
|
||||
public JobParameters getJobParameters() {
|
||||
if (jobExecution == null) {
|
||||
@@ -434,32 +435,32 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of records skipped on read
|
||||
* @return the number of records skipped on read.
|
||||
*/
|
||||
public long getReadSkipCount() {
|
||||
return readSkipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of records skipped on write
|
||||
* @return the number of records skipped on write.
|
||||
*/
|
||||
public long getWriteSkipCount() {
|
||||
return writeSkipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of records skipped on read
|
||||
* Set the number of records skipped on read.
|
||||
*
|
||||
* @param readSkipCount long containing read skip count to be used for the step execution.
|
||||
* @param readSkipCount A {@code long} containing the read skip count to be used for the step execution.
|
||||
*/
|
||||
public void setReadSkipCount(long readSkipCount) {
|
||||
this.readSkipCount = readSkipCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of records skipped on write
|
||||
* Set the number of records skipped on write.
|
||||
*
|
||||
* @param writeSkipCount long containing write skip count to be used for the step execution.
|
||||
* @param writeSkipCount A {@code long} containing write skip count to be used for the step execution.
|
||||
*/
|
||||
public void setWriteSkipCount(long writeSkipCount) {
|
||||
this.writeSkipCount = writeSkipCount;
|
||||
@@ -473,9 +474,9 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of records skipped during processing.
|
||||
* Sets the number of records skipped during processing.
|
||||
*
|
||||
* @param processSkipCount long containing process skip count to be used for the step execution.
|
||||
* @param processSkipCount A {@code long} containing the process skip count to be used for the step execution.
|
||||
*/
|
||||
public void setProcessSkipCount(long processSkipCount) {
|
||||
this.processSkipCount = processSkipCount;
|
||||
@@ -489,17 +490,17 @@ public class StepExecution extends Entity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the time when the StepExecution was last updated before persisting
|
||||
* Sets the time when the {@code StepExecution} was last updated before persisting.
|
||||
*
|
||||
* @param lastUpdated {@link Date} instance used to establish the last
|
||||
* updated date for the Step Execution.
|
||||
* @param lastUpdated the {@link Date} instance used to establish the last
|
||||
* updated date for the {@code StepExecution}.
|
||||
*/
|
||||
public void setLastUpdated(Date lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The {@link List} of {@link Throwable} objects.
|
||||
* @return the {@link List} of {@link Throwable} objects.
|
||||
*/
|
||||
public List<Throwable> getFailureExceptions() {
|
||||
return failureExceptions;
|
||||
@@ -538,10 +539,10 @@ public class StepExecution extends Entity {
|
||||
* Deserialize and ensure transient fields are re-instantiated when read
|
||||
* back.
|
||||
*
|
||||
* @param stream instance of {@link ObjectInputStream}.
|
||||
* @param stream An instance of {@link ObjectInputStream}.
|
||||
*
|
||||
* @throws IOException thrown if error occurs during read.
|
||||
* @throws ClassNotFoundException thrown if class is not found.
|
||||
* @throws IOException If an error occurs during read.
|
||||
* @throws ClassNotFoundException If the class is not found.
|
||||
*/
|
||||
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,16 +38,16 @@ public interface StepExecutionListener extends StepListener {
|
||||
|
||||
/**
|
||||
* Give a listener a chance to modify the exit status from a step. The value
|
||||
* returned will be combined with the normal exit status using
|
||||
* returned is combined with the normal exit status by using
|
||||
* {@link ExitStatus#and(ExitStatus)}.
|
||||
*
|
||||
* Called after execution of step's processing logic (both successful or
|
||||
* failed). Throwing exception in this method has no effect, it will only be
|
||||
* Called after execution of the step's processing logic (whether successful or
|
||||
* failed). Throwing an exception in this method has no effect, as it is only
|
||||
* logged.
|
||||
*
|
||||
* @param stepExecution {@link StepExecution} instance.
|
||||
* @param stepExecution a {@link StepExecution} instance.
|
||||
* @return an {@link ExitStatus} to combine with the normal value. Return
|
||||
* {@code null} to leave the old value unchanged.
|
||||
* {@code null} (the default) to leave the old value unchanged.
|
||||
*/
|
||||
@Nullable
|
||||
default ExitStatus afterStep(StepExecution stepExecution) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2008 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,10 +17,10 @@ package org.springframework.batch.core;
|
||||
|
||||
/**
|
||||
* Marker interface that acts as a parent to all step
|
||||
* domain listeners, such as: {@link StepExecutionListener},
|
||||
* {@link ChunkListener}, {@link ItemReadListener} and
|
||||
* domain listeners, such as: {@link StepExecutionListener},
|
||||
* {@link ChunkListener}, {@link ItemReadListener}, and
|
||||
* {@link ItemWriteListener}
|
||||
*
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,18 +19,18 @@ package org.springframework.batch.core;
|
||||
/**
|
||||
* Indicates to the framework that a critical error has occurred and processing
|
||||
* should immediately stop.
|
||||
*
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class UnexpectedJobExecutionException extends RuntimeException {
|
||||
private static final long serialVersionUID = 8838982304219248527L;
|
||||
|
||||
/**
|
||||
* Constructs a new instance with a message.
|
||||
*
|
||||
* @param msg the exception message.
|
||||
*
|
||||
*
|
||||
* @param msg The exception message.
|
||||
*
|
||||
*/
|
||||
public UnexpectedJobExecutionException(String msg) {
|
||||
super(msg);
|
||||
@@ -38,10 +38,10 @@ public class UnexpectedJobExecutionException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Constructs a new instance with a message.
|
||||
*
|
||||
* @param msg the exception message.
|
||||
* @param nested instance of {@link Throwable} that is the cause of the exception.
|
||||
*
|
||||
*
|
||||
* @param msg The exception message.
|
||||
* @param nested An instance of {@link Throwable} that is the cause of the exception.
|
||||
*
|
||||
*/
|
||||
public UnexpectedJobExecutionException(String msg, Throwable nested) {
|
||||
super(msg, nested);
|
||||
|
||||
Reference in New Issue
Block a user