CLOSED - issue BATCH-136: restoreFromRestartData(Tasklet, RestartData) crashes if Properties are null
http://opensource.atlassian.com/projects/spring/browse/BATCH-136
This commit is contained in:
@@ -21,13 +21,13 @@ import java.util.Properties;
|
||||
public class GenericRestartData implements RestartData {
|
||||
|
||||
private Properties data;
|
||||
|
||||
|
||||
public GenericRestartData(Properties data){
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public Properties getProperties(){
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,10 +16,41 @@
|
||||
|
||||
package org.springframework.batch.restart;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Marker interface defining a contract for periodically storing
|
||||
* state and restoring from that state should an error occur.
|
||||
* <p>
|
||||
*
|
||||
* <p>The state that is stored is represented as {@link RestartData}
|
||||
* which enforces a requirement that any restart data can be represented
|
||||
* by a Properties object. In general, the contract is that RestartData
|
||||
* that is returned via the getRestartData method will be given back to
|
||||
* the restoreFrom method, exactly as it was provided. However, since
|
||||
* it is primarily stored in a database, there is almost no way to know
|
||||
* the whether a blank column in the database refers to null data,
|
||||
* null properties, or empty properties. Therefore, any class implementing
|
||||
* this interface should assume that no restart data is equivalent to
|
||||
* data with empty Properties.
|
||||
* </p>
|
||||
*
|
||||
* @author Lucas Ward
|
||||
*
|
||||
*/
|
||||
public interface Restartable {
|
||||
|
||||
/**
|
||||
* Get RestartData representing this object's current state. Ideally,
|
||||
* if no state should be stored, RestartData.getProperties should return
|
||||
* an empty Properties object.
|
||||
*
|
||||
* @return RestartData representing current state.
|
||||
*/
|
||||
RestartData getRestartData();
|
||||
|
||||
/**
|
||||
* Restart state given the provided RestartData.
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
void restoreFrom(RestartData data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user